Skip to main content

No project description provided

Project description

Data transformation library

This python library consists of 3 common data transformation functions:

  • transpose2d
  • window1d
  • convolution2d

Installation

You can install this package using pip:

pip install data-trans-lib

This library is supported on Python 3.9 and above.

How to use

transpose2D

Transposes a 2-D list - switches rows and columns.

Parameters: input_matrix - is a list of lists of real numbers to transpose.

Example usage

from data_trans_lib.transformations import transpose2d

input_matrix = [[1.0, 2.0, 3.0],
                [4.0, 5.0, 6.0]]

transposed_matrix = transpose2d(input_matrix)

# Output:
# [[1.0, 4.0],
#  [2.0, 5.0],
#  [3.0, 6.0]]

window1D

Extracts specified size windows from a 1D list or numpy array. The shift for the starting position of the window and the stride between consecutive windows could be specified.

Parameters: input_array - is a list or 1D Numpy array of real numbers from which windows are extracted. size - is a positive integer that determines the size (length) of the window. shift is a positive integer that determines the shift (step size) between different windows. stride is a positive integer that determines the stride (step size) within each window. Default shift and stride values equals to .

Example usage

from data_trans_lib.transformations import window1d

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

windows = window1d(input_array, size, shift, stride)

# Output:
# [[1, 3, 5],
#  [3, 5, 7],
#  [5, 7, 9]]

convolution2d

Performs 2D convolution between the input matrix and the kernel with the specified stride, and it returns the resulting 2D NumPy array. The convolution operation is implemented by sliding the kernel over the input matrix with the specified stride and computing the element-wise multiplication and summation.

Parameters: input_matrix - is a 2D Numpy array of real numbers to convolve. kernel - is a 2D Numpy array of real numbers. stride is a positive integer that determines the stride (step size) within each window. Default stride value equals to 1.

Example usage

import numpy as np
from data_trans_lib.transformations import convolution2d

input_matrix = np.array([[0, 1, 2], [3, 4, 5], [6, 7, 8]])
kernel = np.array([[0, 1], [1, 0]])
 
convolution = convolution2d(input_matrix, kernel)

# Output:
# [[ 4,  6],
#  [10, 12]

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

data_trans_lib-0.1.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

data_trans_lib-0.1.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file data_trans_lib-0.1.0.tar.gz.

File metadata

  • Download URL: data_trans_lib-0.1.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for data_trans_lib-0.1.0.tar.gz
Algorithm Hash digest
SHA256 30a292bd12c45b962dd1d2d6af0c42eb8ac90c0b4d3d470723fa4226e99747c3
MD5 70845de0247b4e9216eb48ce3d04f735
BLAKE2b-256 a3c6d78f27ed7e24d6be1c5308dd357a9ca4ea32d691f7921635a1c252f4c708

See more details on using hashes here.

File details

Details for the file data_trans_lib-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: data_trans_lib-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for data_trans_lib-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7e26a410a5de20b19bd4516e281da21676977e14b9b6a8a2429821f11c0d55a
MD5 612662c169f356acc4d02e13586f7fea
BLAKE2b-256 a9ac0098e0522f2376185ecd220ba0b02bc54cf5dec3b25cbb3847fe86607233

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