Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import xml.etree.ElementTree as ET
- import pandas as pd
- mytree = ET.parse('plik_xml.xml')
- myroot = mytree.getroot()
- for i, item in enumerate(myroot):
- print(i, item.tag)
- len = len(myroot[6].findall('run'))
- all_runs_list = [ [] for x in range(len)]
- for n in range(len):
- for i in myroot[6].findall('run')[n]:
- all_runs_list[n].append(i.attrib)
- for k in range(len):
- pd.DataFrame(all_runs_list[k]).to_csv('output{}.csv'.format(k), float_format='%.3f')
- df1 = pd.read_csv('output0.csv')
- df2 = pd.read_csv('output1.csv')
- columns = ['number', 'depth', 'A', 'B', 'T', 'H', 'V', 'S']
- df_1 = df1.copy()
- df_2 = df2.copy()
- print(df_1[columns].reset_index())
- print(df_2[columns].reset_index())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement