Skip to content
Snippets Groups Projects
Commit f4d1d204 authored by wonko's avatar wonko
Browse files

convert plan from excel

parent 255a25c0
No related branches found
No related tags found
No related merge requests found
File added
import pandas as pd
import json
df = pd.read_excel('Vortragsplan_12_05.xlsx', sheet_name='Tabelle1', header=1)
schedule = []
times = {}
for idx, ser in df.iterrows():
if pd.notna(ser['Zeit']):
times[ser['Zeit']] = idx
for room, ser in df.items():
if not room.startswith('Unnamed') and not room.startswith('Zeit'):
roomo = {'name': room}
roomtimes = []
for t, i in times.items():
if pd.notna(ser[i]):
tl = {'time': t}
lecture = {}
lecture['fs'] = ser[i]
lecture['name'] = ser[i + 1]
lecture['teaser'] = ser[i + 2]
lecture['time'] = t
lecture['room'] = room
tl['lecture'] = lecture
roomtimes.append(tl)
roomo['times'] = roomtimes
schedule.append(roomo)
print(times)
print(schedule)
jsondata = {'schedule': schedule, 'version': '20190515001'}
with open('lectures.json', 'w') as outfile:
json.dump(jsondata, outfile, indent=1)
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