Skip to main content

Python library to data transformation

Project description

Data Transformation Library

The Data Transformation Library is a Python library that provides a set of functions for common data transformation tasks. It contains simple function to make their every day coding easier.

Features

  1. Transpose a Matrix (2D Tensor)

    • Function: transpose2d
    • Transposes the axes of a 2D list.
  2. Time Series Windowing

    • Function: window1d
    • Creates sliding windows over a 1D list or NumPy array.
  3. 2D Convolution

    • Function: convolution2d
    • Applies 2D cross-correlation to an input matrix using a kernel.

Installation

You can install the package using pip:

pip install datatransformtoolbox
 
or

poetry add datatransformtoolbox

Usage

Here is a simple example of how to use transpose library:

import numpy as np
from datatransformtoolbox.transpose import transpose2d


matrix = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
]

transposed_matrix = transpose2d(matrix)
print(transposed_matrix)
# Output: [[1, 4, 7], [2, 5, 8], [3, 6, 9]]

Another simple example of how to use Time series Windowing library:

import numpy as np
from datatransformtoolbox.window import window1

input_array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
size = 2
shift = 1
stride = 1

# Call the function
windows = window1d(input_array, size, shift, stride)

# Print the results
print("Generated windows:")
for i, window in enumerate(windows):
    print(f"Window {i+1}: {window}")

# Example output:
#Generated windows:
#Window 1: [1 2]
#Window 2: [2 3]
#Window 3: [3 4]
#Window 4: [4 5]
#Window 5: [5 6]
#Window 6: [6 7]
#Window 7: [7 8]
#Window 8: [8 9]
#Window 9: [ 9 10]

Another simple example of how to use Cross-Correlation library:

# Define the input matrix and kernel
input_matrix = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
kernel = np.array([[1, 0], [0, -1]])

# Perform the 2D convolution with a stride of 1
result = convolution2d(input_matrix, kernel, stride=1)

# Print the result
print(result)

#Output
#[[-4. -4.]
# [-4. -4.]]

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Authors

Johnny Lazo johnny.lazoq@gmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datatransformtoolbox-0.1.4.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datatransformtoolbox-0.1.4-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file datatransformtoolbox-0.1.4.tar.gz.

File metadata

  • Download URL: datatransformtoolbox-0.1.4.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for datatransformtoolbox-0.1.4.tar.gz
Algorithm Hash digest
SHA256 c0966cf7c31792f15fa6ca272759e9c66547f837c703cabea58a09a638dd412e
MD5 d874720f23adc8ad34e67903c5d36bfd
BLAKE2b-256 e14f8d9a5f6fb955bdf24107447878b99b545181aa81e8eb45f69b72266de18f

See more details on using hashes here.

File details

Details for the file datatransformtoolbox-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: datatransformtoolbox-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for datatransformtoolbox-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cb50cb8b7c9932e8a3660cf26819e71507b4723725531c60577d11180e9a3d46
MD5 65f998a5a5645811a3fa326a79aaf2a6
BLAKE2b-256 7d8a39bb2a6aa65d104046694593f649d35f27db344419b253ec0d6de3a69212

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page