I have a GeoDataFrame like this
import pandas as pd
import geopandas
df = pd.DataFrame(
{'City': ['Buenos Aires', 'Brasilia', 'Santiago', 'Bogota', 'Caracas'],
'Country': ['Argentina', 'Brazil', 'Chile', 'Colombia', 'Venezuela'],
'Latitude': [-34.58, -15.78, -33.45, 4.60, 10.48],
'Longitude': [-58.66, -47.91, -70.66, -74.08, -66.86]})
gdf = geopandas.GeoDataFrame(
df, geometry=geopandas.points_from_xy(df.Longitude, df.Latitude))
gdf.set_index("City", inplace = True)
Now I want to have a subset of the Data. I do this by
gdf.loc["Santiago"]
However, this returns a
type(gdf.loc["Santiago"])
<class 'pandas.core.series.Series'>
I want a GeoDataFrame
as a return / Convert pandas.core.series.Series
into a GeoDataFrame
. How would I do that?