geolime.utilities.dataframe

Classes:

Point(*args)

A zero dimensional feature

Functions:

df_to_gdf(df[, x_col, y_col, crs])

Converts a DataFrame to a GeoDataFrame

gdf_to_df(gdf[, copy])

Converts a DataFrame to a GeoDataFrame

geolime.utilities.dataframe.df_to_gdf(df: pandas.core.frame.DataFrame, x_col: str = 'x', y_col: str = 'y', crs: str = None)

Converts a DataFrame to a GeoDataFrame

Parameters
  • df (pd.DataFrame) – original DataFrame to convert

  • x_col (pd.DataFrame) – column name containing the x coordinates

  • y_col (pd.DataFrame) – column name containing the y coordinates

  • crs (str) – coordinates system of the GeoDataFrame

Returns

The converted GeoDataFrame

Return type

pd.GeoDataFrame

geolime.utilities.dataframe.gdf_to_df(gdf: geopandas.geodataframe.GeoDataFrame, copy: bool = False)

Converts a DataFrame to a GeoDataFrame

Parameters
  • gdf (pd.GeoDataFrame) – original DataFrame to convert

  • copy (bool) – copy the data of the GeoDataFrame before converting. useful to keep the GeoDataFrame and DataFrame independant.

Returns

The converted DataFrame

Return type

pd.DataFrame