Skip to main content

A utility to generate to_sequential data for LSTM models from a Pandas DataFrame.

Project description

To Sequential

to_sequential is a simple utility function to generate sequential data from a Pandas DataFrame, making it suitable for preparing data for sequential models.

Usage

Here's a basic example of how to use the generate_sequences function:

import pandas as pd
from to_sequential import generate_sequences

df = pd.read_csv('Example.csv')

# Generate sequences
sequences, targets = generate_sequences(df, window_size=10, column_names=['feature1', 'feature2'])

print("Sequences:\n", sequences)
print("Targets:\n", targets)

Function Documentation

generate_sequences Generate sequential data for sequential model.

Parameters

  • df (pd.DataFrame): The input data frame.
  • window_size (int): The size of the window for the sequences.
  • column_names (List[str]): List of column names to use for generating sequences.

Returns

  • np.ndarray: Array of sequences of shape (number_of_sequences, window_size, number_of_columns).
  • np.ndarray: Array of targets of shape (number_of_sequences, number_of_columns).

Raises

  • ValueError: If any column in column_names is not found in the DataFrame.

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

to_sequential-0.1.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

to_sequential-0.1.0-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: to_sequential-0.1.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.10

File hashes

Hashes for to_sequential-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fc21bddf6d63bfc6424ff409567b7a9fd0193fb344ea53b311aaaa1a0f715d32
MD5 2fe7c5536ad0f04fbad3f23912c782d3
BLAKE2b-256 9c8c43783f849d34e97311da77bdc1fdcdb7b5e4eaf07f93f049b0d8fa828b24

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for to_sequential-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cdf5e9338161f04adf2094613559f0ae4dedaf6912458871ddec0e723b925ca7
MD5 150b9e604dfe007a5caab2b0e0219e7c
BLAKE2b-256 47a83f7d8727da042d086a0a113919802ece4f1ffeb80dd9d79fd135de625251

See more details on using hashes here.

Supported by

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