impute
impute_opm(include_categorical=False, data_home='data', strategy='most_frequent', columns=['lat', 'lon'], archive_name='opm_cat.csv', path_or_buf='opm_cat.zip', write_csv=True, return_df=False)
¶
Impute missing values in OPM dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
include_categorical |
bool
|
Whether to include categorical features. Default is False. |
False
|
data_home |
str
|
The directory to use as a data store. Default is “data”. |
'data'
|
strategy |
str
|
The imputation strategy to use. Can be one of “mean”, “median”, “most_frequent”, or “constant”. Default is “most_frequent”. |
'most_frequent'
|
columns |
list[str]
|
A list of column names to impute. If None, impute all columns. Default is [“lat”, “lon”]. |
['lat', 'lon']
|
archive_name |
str
|
The name of the archive file to write. Default is “opm_cat.csv”. |
'opm_cat.csv'
|
path_or_buf |
str
|
The file path or buffer to write. Default is “opm_cat.zip”. |
'opm_cat.zip'
|
write_csv |
bool
|
Whether to write the imputed data to a CSV file. Default is True. |
True
|
return_df |
bool
|
Whether to return the imputed data as a DataFrame. Default is False. |
False
|
Returns:
Type | Description |
---|---|
DataFrame
|
If |
Source code in spotriver/preprocess/impute.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|