Skip to content

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

file_name

str

The filename of the resource to load. Accepts only .csv files.

required

is_local

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
cb.load_csv_as_df(file_name="table.csv")

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

file_name

str

The name of the file to load.

required

is_local

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")