Compute resources
ComputeResourcesMixin
¶
load_csv_as_df
staticmethod
¶
load_csv_as_df(file_name, is_local=True)
Load the csv from the app static resources.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The filename of the resource to load. Accepts only .csv files. |
required |
|
bool
|
If local the file should reside within the parent folder of this app. Alternatively, this can be set to False and the file should be located within the "shared" folder. Defaults to True. |
True
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame: Returns the csv file as a Pandas.Dataframe object. |
Examples:
1 | |
load_file_as_bytes
staticmethod
¶
load_file_as_bytes(file_name, is_local=True)
Loads a file as bytes from the app static resources.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The name of the file to load. |
required |
|
bool
|
If local the file should reside within the parent folder of this app. Alternatively, this can be set to False and the file should be located within the "shared" folder. Defaults to True. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
bytes |
bytes
|
The content of the file as a byte array. |
Examples:
file_bytes = cb.load_file_as_bytes(file_name="example.txt")