Skip to content
Snippets Groups Projects
Commit c956342e authored by Christoph Olberding's avatar Christoph Olberding
Browse files

Upload New File

parent e03885a1
Branches
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 26 12:57:45 2021
@author: Christoph
"""
import pandas as pd
import numpy as np
data = pd.read_csv('data.csv')
data= data.iloc[:,1:]
timeinterval=[0]
minutes=[0]
indexes=[]
time=0
minute=0
for h in range(108):
h=h+1
if (h<13 or (h>48 and h<63) or h>98):
time=time + (30*60)
minute = minute+30
if ((h>12 and h<49)or (h>62 and h<99)):
time=time + (5*60)
minute=minute+5
timeinterval.append(time)
minutes.append(minute)
indexes.append(h)
timeinterval=np.asarray(timeinterval)
minutes=np.asarray(minutes)
indexes=np.asarray(indexes)
for h in range(np.asarray(timeinterval).shape[0]-1):
data.loc[(data['time']>timeinterval[h]) & (data['time']<=timeinterval[h+1]), 'time'] = indexes[h] #data.loc[(data['time']>timeinterval[h]) & (data['time']<=timeinterval[h+1]), 'time'] = indexes[h]
d=data.copy()
for e in data['day_index'].unique(): # für alle verschiedenen tages_indexe
day_data=data.loc[data['day_index'] == e] # nur die einzelnen Tage
for h in indexes: #für alle zeit_indexe der tage
for k in day_data['Streckenvorhersage.ZielortID'].unique(): # für alle verschiedenen Zielorte
day_data_location=day_data.loc[day_data['Streckenvorhersage.ZielortID'] == k] # auteilung der tageswerte nach zielort
exists=False;
for l in day_data_location['time'].unique(): #für alle verschiedenen EXISTENTEN zeiten im Tag
if(h==l):
exists=True # wenn die Zeit existiert
if (exists==False):
new_row={'Streckenvorhersage.ZielortID':k,'Streckenvorhersage.StartortID': 1,'Streckenvorhersage.Dauer':0,'time':h,'day_index':e}
data = data.append(new_row, ignore_index=True)
data.to_csv('data_unfilled.csv')
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment