I want to summarise each day of my table. The values in the original table are minutes, but these are way to exactly I only need the value of 24 hours. The original table looks like this three columns and x rows:
Datum Zeit Rad
01.01.2017 00:01:00 0
01.01.2017 00:02:00 0
01.01.2017 00:03:00 0
01.01.2017 00:04:00 0
01.01.2017 00:05:00 0
01.01.2017 00:06:00 0
01.01.2017 00:07:00 0
01.01.2017 00:08:00 0
01.01.2017 00:09:00 0
01.01.2017 00:10:00 0
I changed the datetime with pandas to 2017-01-01 so that the table looks like: 2017-01-01 00:01:00 0
Is it even possible to count every Bike(Rad) on every day.
My idea is, sum all Bike(Rad) till the datetime changes to 02.01.2017 and then to 03.01.2017.
import pandas as pd
import numpy as np
Tab = pd.read_csv('Komplett.csv', delimiter=';')
print(Tab.head())
#Tab.Rad = Tab.Rad.astype(int)
#Tab.Rad.astype(int)
#print(Tab.Rad.dtypes)
#print(Tab.Rad)
#print(Tab.Rad[0:1440])
#print(Tab[0:1439])
#print(len(Tab))
#sum = np.sum(Tab.Rad[0:1439])
#Date = Tab.Datum[1438]
#print(Date, sum)
Tab['Datum'] = pd.to_datetime(Tab.Datum)
print(Tab.head())
#Day=Tab[Tab.Datum=='2017-01-01']
#print(np.sum(Day.Rad))
New output:
Datum Zeit Rad
0 01.01.2017 00:01:00 0
1 01.01.2017 00:02:00 0
2 01.01.2017 00:03:00 0
3 01.01.2017 00:04:00 0
4 01.01.2017 00:05:00 0
Datum Zeit Rad
0 2017-01-01 00:01:00 0
1 2017-01-01 00:02:00 0
2 2017-01-01 00:03:00 0
3 2017-01-01 00:04:00 0
4 2017-01-01 00:05:00 0