Data Modules
Data Loader
- class data.data_loader.DataLoader(path, file_type=None, index=None, index_col=None, date_col=None, date_format=None)
Initializes a DataLoader object that loads in data to a dataframe and performs basic filtering and formatting.
- Parameters:
path (string) – Path to the data file
file_type (string) – File type of data file
index (string) – Index to filter dataset by (ex: “NYA”)
index_col (string) – Column to search for index (ex: “Stock Exchange”)
date_col (string) – Column that stores date data
date_format (string) – Format of date data
- Returns:
None
- date_index(date_col, date_format='%Y-%m-%d')
Turns a string date column into a date object and calculates an index based on date
- Parameters:
date_col (string) – Column that stores date data
date_format (string) – Format of date data
- Returns:
True if date column exists and data processing is applied, False otherwise
- Return type:
boolean
- filter_index(index, index_col='Index')
Filters for specific indices in data, useful for filtering for a specific company or group
- Parameters:
index (string) – Index to filter dataset by (ex: “NYA”)
- Returns:
True if index column exists and filter is applied, False otherwise
- Return type:
boolean
- load_data(file_type='csv')
Loads data into dataframe object based on file type
- Parameters:
file_type (string) – File type of data file
- Returns:
None