update. /JL
This commit is contained in:
15
my_pandas.py
Normal file
15
my_pandas.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import pandas as pd
|
||||
import io
|
||||
|
||||
print("Pandas version: ", pd.__version__)
|
||||
|
||||
def xml2df(xml_file):
|
||||
with open(xml_file, "r") as F:
|
||||
xml_data = F.read()
|
||||
return pd.read_xml(io.StringIO(xml_data), parser="etree", xpath=".//component-class//feature-value")
|
||||
|
||||
if __name__ == "__main__":
|
||||
df = xml2df("test_data.tcx")
|
||||
df.assign(counter = lambda df: df.groupby('.//component/name').cumcount())
|
||||
|
||||
print(df)
|
||||
Reference in New Issue
Block a user