Skip to content
Snippets Groups Projects
Commit 6b109213 authored by JOSSOUD Olivier's avatar JOSSOUD Olivier
Browse files

Explo. ManualEvent. Manage case where there is only one event in file.

parent 1a7b57df
No related branches found
No related tags found
No related merge requests found
...@@ -312,7 +312,10 @@ class ManualEventLog(InstrumentLog): ...@@ -312,7 +312,10 @@ class ManualEventLog(InstrumentLog):
# Convert the XML to dict, then convert the dict to pd.Dataframe # Convert the XML to dict, then convert the dict to pd.Dataframe
xml_dict = xmltodict.parse(xml_str) xml_dict = xmltodict.parse(xml_str)
df = pd.DataFrame.from_dict(xml_dict["root"]["event"]) if "datetime" in xml_dict["root"]["event"]: # Only 1 event -> one less level in dict tree
df = pd.DataFrame([xml_dict["root"]["event"]])
else:
df = pd.DataFrame.from_dict(xml_dict["root"]["event"])
# Rename "description" column # Rename "description" column
df.rename(columns={"description": 'event'}, inplace=True) df.rename(columns={"description": 'event'}, inplace=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment