A Python library for data transformations
Project description
Data Transformations Library
This is a Python library for performing common data transformations used in machine learning and data science workflows. The library includes functions for transposing matrices, creating time series windows, and performing 2D cross-correlation.
Features
- Transpose Function: Transposes a 2D matrix (list of lists).
- Time Series Windowing Function: Creates windows from a 1D array with specified size, shift, and stride.
- Cross-Correlation Function: Performs 2D cross-correlation on an input matrix using a given kernel.
Installation
To install the library, use pip3
:
pip3 install eimantas_data_transformations
Or, if you are using Poetry, add it to your project with:
poetry add eimantas_data_transformations
Usage
Transpose Function
Transposes a 2D matrix (list of lists). This function takes a 2D matrix represented as a list of lists and returns a new matrix that is the transpose of the input matrix. Transposing a matrix means switching the rows and columns.
Example:
from eimantas_data_transformations.transformations import transpose2d
matrix = [[1, 2, 3], [4, 5, 6]]
transposed = transpose2d(matrix)
print(transposed)
# Output: [[1, 4], [2, 5], [3, 6]]
Time Series Windowing Function
Creates windows from a 1D array with specified size, shift, and stride.
Example:
from eimantas_data_transformations.transformations import window1d
input_array = [1, 2, 3, 4, 5, 6, 7, 8, 9]
windows = window1d(input_array, size=3, shift=2, stride=2)
print(windows)
# Output: [[1, 3, 5], [3, 5, 7], [5, 7, 9]]
Cross-Correlation Function
Performs 2D cross-correlation on an input matrix using a given kernel.
Example:
import numpy as np
from eimantas_data_transformations.transformations import convolution2d
input_matrix = np.array([
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12],
[13, 14, 15, 16]
])
kernel = np.array([
[1, 0],
[0, 1]
])
result = convolution2d(input_matrix, kernel, stride=2)
print(result)
# Output: [[ 7. 11.]
# [23. 27.]]
Author
Eimantas Venslovas
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file eimantas_data_transformations-0.1.1.tar.gz
.
File metadata
- Download URL: eimantas_data_transformations-0.1.1.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.2 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2b3e687000fce318fb0f0fdb27b974737641605b8dd962c48481b9545bb5027 |
|
MD5 | 2590d224249231db7d48bfa5c5cd4c9f |
|
BLAKE2b-256 | 76571d6732162d4e04a1df4d0f19737e130ec46e3c36b600255683df8e950d7c |
File details
Details for the file eimantas_data_transformations-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: eimantas_data_transformations-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.2 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a81f2c4aa7a3eea24e82cc659f7a60ddee0ed85dbac497b04ede153e295f978 |
|
MD5 | 38aff52c787f0d4d444e3d7718c344a1 |
|
BLAKE2b-256 | b65dc459c3da711cee8118190f2271acb267ecca9ad527b8a93c3bfe14f8c5ad |