A utility to generate sequential data for sequential 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
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file to_sequential-0.2.0.tar.gz.
File metadata
- Download URL: to_sequential-0.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c21fdf9dd885f985a5b8ec970fabc19d581d531f9389f7c46c4b193d771d366
|
|
| MD5 |
1e65045131399e4750f74e5e1212b7ba
|
|
| BLAKE2b-256 |
9795813d38439f94dab2e7774791b288b236bfe9739594754c5fda7e0e62b848
|
File details
Details for the file to_sequential-0.2.0-py3-none-any.whl.
File metadata
- Download URL: to_sequential-0.2.0-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb2050a223ec7d48789cd053dd558e669d23d86be9f9eb5361c8fa5d28819da2
|
|
| MD5 |
8efc2dc78a221fde16ade1682d30f6a9
|
|
| BLAKE2b-256 |
9b4c81adb59284d46867edb1ddad350806f9ebc36582b044afd430d4d3f8ec15
|