bgc_data_processing.core.loaders.base
¶
Base Loaders.
BaseLoader(provider_name, category, exclude, variables)
¶
Bases: ABC
Base class to load data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
provider_name |
str
|
Data provider name. |
required |
category |
str
|
Category provider belongs to. |
required |
exclude |
list[str]
|
Filenames to exclude from loading. |
required |
variables |
SourceVariableSet
|
Storer object containing all variables to consider for this data, both the one in the data file but and the one not represented in the file. |
required |
Source code in src/bgc_data_processing/core/loaders/base.py
30 31 32 33 34 35 36 37 38 39 40 |
|
provider: str
property
¶
_provider attribute getter.
Returns:
Type | Description |
---|---|
str
|
data provider name. |
category: str
property
¶
Returns the category of the provider.
Returns:
Type | Description |
---|---|
str
|
Category provider belongs to. |
variables: LoadingVariablesSet
property
¶
_variables attribute getter.
Returns:
Type | Description |
---|---|
LoadingVariablesSet
|
Loading variables storer. |
excluded_filenames: list[str]
property
¶
Filenames to exclude from loading.
is_file_valid(filepath)
¶
Indicate whether a file is valid to be kept or not.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath |
Path | str
|
Name of the file |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the name is not to be excluded. |
Source code in src/bgc_data_processing/core/loaders/base.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
load(filepath)
abstractmethod
¶
Load data.
Returns:
Type | Description |
---|---|
Any
|
Data object. |
Source code in src/bgc_data_processing/core/loaders/base.py
98 99 100 101 102 103 104 105 106 107 |
|
remove_nan_rows(df)
¶
Remove rows.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
DatafRame on which to remove rows. |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
DataFrame with rows removed |
Source code in src/bgc_data_processing/core/loaders/base.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
|