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:

import numpy as np
from datatransformtoolbox.crosscorrelation import convolution2d

# 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.5.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.5-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: datatransformtoolbox-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 e1d20d3a87ffebd510f8e1811aa6dad6249d362bf425226ad6821c6b760765a7
MD5 0e5eb655fa77e90195bed0fc81957d6b
BLAKE2b-256 1a32d67560938f80fd0ac7a43ee7aa9bcb38f245b857fd7c753c634da0232dc5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: datatransformtoolbox-0.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d2905ce8af203f51bbc36842f5c4b55dcee14461ecf0897f1f6ef37344ace361
MD5 c2f2e856fa789aa6b80f9b3fc07f7fc9
BLAKE2b-256 1e120d366c97560e7e1b158ab39b6278d15af83216a7ef1ae4258f24aae0a9c5

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