ltsm.data_reader package
Submodules
ltsm.data_reader.csv_reader module
- class ltsm.data_reader.csv_reader.CSVReader(data_path)[source]
Bases:
BaseReader
Represents a CSV Reader object for processing time-series data.
This class reads .csv files, fills missing values using linear interpolation, and drops any invalid columns. It assumes that the .csv file’s columns represent time-series data, while each row corresponds to a data instance or feature.
- module_id
The identifier for the base reader objects.
- Type:
str
- data_path
The file path where the .csv file is located.
- Type:
str
- fetch()[source]
Fetches data in the .csv file specified at data_path.
Reads the .csv file, fills missing values, and drops invalid columns.
- Returns:
The data from the .csv as a DataFrame.
- Return type:
pd.DataFrame
- module_id = 'csv'
- ltsm.data_reader.csv_reader.transform_csv(input_file)[source]
This function reads the CSV file, deletes the first row and the first column, replaces the time with 0, 1, 2 sequence, and returns the transformed DataFrame.
- Parameters:
input_file (str) – CSV file path
- Returns:
transformed DataFrame
- Return type:
pd.DataFrame
- ltsm.data_reader.csv_reader.transform_csv_dataset(input_folder, output_folder)[source]
Iterates through all the CSV files in the input folder and converts each one, saving it to the output folder.
- Parameters:
input_folder (str) – path to the folder containing the CSV files to be transformed
output_folder (str) – output folder path
- Returns:
list of transformed DataFrames
ltsm.data_reader.database_reader module
- ltsm.data_reader.database_reader.insert_data_from_csv(conn, database, csv_file, table_name)[source]
ltsm.data_reader.monash_reader module
ltsm.data_reader.npy_database_reader module
- ltsm.data_reader.npy_database_reader.insert_data_from_npy(conn, database, npy_file, table_name, batch_size=100)[source]
ltsm.data_reader.train_database_reader module
- ltsm.data_reader.train_database_reader.insert_data_from_csv(conn, database, csv_file, table_name)[source]
Module contents
- ltsm.data_reader.register_reader(module)[source]
Registers a BaseReader module into the reader dictionary.
- Parameters:
module – A Python module or class that implements a BaseReader.
module_name (str) – The key name for the module in the reader dictionary.
- Raises:
AssertionError – If a reader with the same name is already registered