遵循
ValueError
指南,您需要将 namespace
传递给 read_xml
:
df = (
pd.read_xml(
"testfile.gpx",
xpath=".//doc:trkseg/doc:trkpt",
namespaces={"doc": "http://www.topografix.com/GPX/1/1"}
)
)
输出:
print(df)
lat lon ele time
0 60.126749 4.250254 455.735013 2023-08-20T17:42:34.674Z
1 60.126580 4.250247 455.735013 2023-08-20T17:42:36.695Z
2 60.126484 4.250240 455.735013 2023-08-20T17:44:15.112Z