When looping through a list of Geopandas geodataframes and attempting to get the index value of the current dataframe in the loop, I'm getting ValueError: Can only compare identically-labeled DataFrame objects
on the second pass through the loop. I'm not purposefully comparing anything. Why is this error being thrown?
from pandas import read_csv
from geopandas import GeoDataFrame
from cartoframes.utils import decode_geometry
data = '/<pathtomydata>/data.csv'
# read dataset into a pandas dataframe separated into chunks (aka a 'textFileReader' object)
reader = read_csv(data, chunksize=10)
# loop through chunks, turning each chunk into a geopandas geodataframe, and add them all to a list
geo_chunks = []
for df_chunk in reader:
gdf = GeoDataFrame(df_chunk, geometry=decode_geometry(df['the_geom']))
geo_chunks.append(gdf)
# loop through the list of geodataframes
for gdf in geo_chunks:
print(geo_chunks.index(gdf)) # <-- ValueError occurs here (2nd time through loop)
<do more stuff>