onehealth_db.duck_database module⚓︎
onehealth_db.duck_database
⚓︎
Functions:
-
file_to_dataframe
–Convert a netCDF/GRIB file to a pandas DataFrame.
-
import_data
–Import data from a CSV file into the DuckDB database.
Attributes:
file_to_dataframe
⚓︎
Convert a netCDF/GRIB file to a pandas DataFrame.
Parameters:
-
file_path
(Path
) –The path to the file.
-
columns
(Union[List[str], Literal['all', 'default']]
, default:'default'
) –The columns to include in the DataFrame.
If "all", all columns are included.
If "default", default columns are included.
If a list, only the specified columns are included.
Returns:
-
DataFrame
–pd.DataFrame: The DataFrame containing the data from the file.
import_data
⚓︎
Import data from a CSV file into the DuckDB database.
Parameters:
-
data
(DataFrame
) –The DataFrame to import.
-
db_path
(Path
, default:None
) –The path to the DuckDB database file.
-
table_name
(str
, default:None
) –The name of the table to create in the database.