tdfs4ds.datasets¶
tdfs4ds.datasets
¶
outstanding_amounts_dataset_filename
module-attribute
¶
outstanding_amounts_dataset
¶
Load and return a dataset of outstanding amounts from a CSV file.
This function reads a CSV file named by the variable outstanding_amounts_dataset_filename located in the
"data" subdirectory of the directory specified by package_dir. It parses the 'OUTSTANDING_DATE' column in the
dataset as dates.
Returns:
| Type | Description |
|---|---|
|
pandas.DataFrame: A DataFrame containing the dataset of outstanding amounts. The 'OUTSTANDING_DATE' column |
|
|
is parsed as datetime objects. |
Note
- This function requires the
pandaslibrary to be imported aspd. - The variables
package_dirandoutstanding_amounts_dataset_filenamemust be defined in the scope where this function is called. - The CSV file must have a column named 'OUTSTANDING_DATE' for the date parsing to work correctly.
upload_outstanding_amounts_dataset
¶
Uploads the outstanding amounts dataset to a database table and returns the table as a DataFrame.
This function uploads the dataset returned by outstanding_amounts_dataset() to a specified table in a database.
If a 'schema_name' is provided via keyword arguments, it uploads the data to that schema; otherwise, it uses the
default schema. It prints to the console where the dataset is uploaded. After uploading, it retrieves the newly
uploaded table into a DataFrame and returns it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table_name
|
str
|
The name of the database table where the dataset will be uploaded. Defaults to 'outstanding_amount_dataset'. |
'outstanding_amount_dataset'
|
**kwargs
|
Arbitrary keyword arguments. Can be used to specify 'schema_name' and other parameters that
|
{}
|
Returns:
| Type | Description |
|---|---|
|
tdml.DataFrame: A DataFrame representing the database table into which the dataset was uploaded. This DataFrame is created either in the specified schema (if 'schema_name' is provided) or the default schema. |
Note
- This function requires the
tdmllibrary to be available and correctly configured to interact with the target database. - The
outstanding_amounts_dataset()function is called within this function to obtain the dataset to upload. - If 'schema_name' is provided in
kwargs, it is used for both uploading the dataset and retrieving it into a DataFrame. If not provided, a notice is printed, and the default schema is used.