After a Pandas-update, I get a bunch of warnings for append to be depecated. This is the code to analyze a gpx file:
import pandas as bib_pandas
gpx = mod_gpxpy.parse(open(dir_file)) # read GPX-File
gpx_points = gpx.tracks[0].segments[0].points
data_frame = bib_pandas.DataFrame(columns=["lon", "lat", "elev", "time"])
for point in gpx_points:
# data_frame = data_frame.append({"lon": point.longitude, "lat": point.latitude, "elev": point.elevation, "time": point.time}, ignore_index=True) # OLD code, works, with warning!
bib_pandas.concat([data_frame, {"lon": point.longitude, "lat": point.latitude, "elev": point.elevation, "time": point.time}], ignore_index=True) # NEW Code, ERROR
As shown above, I tried to use concat instead of append, but this gives an error:
TypeError: cannot concatenate object of type '<class 'dict'>'; only Series and DataFrame objs are valid
With my old code, thedataframe looks like this:
lon lat elev time
0 14.936605 55.498336 421.0 2020-08-20 07:15:39+00:00
.. ... ... ... ...
416 13.936569 55.498304 421.0 2020-08-20 08:12:16+00:00
[417 rows x 4 columns]
How can I fix this?