How split a column in two colunms in pandas
Posted
by
user1345283
on Stack Overflow
See other posts from Stack Overflow
or by user1345283
Published on 2013-10-25T01:58:47Z
Indexed on
2013/10/25
3:54 UTC
Read the original article
Hit count: 340
I have el next dataframe
data=read_csv('enero.csv')
data
Fecha DirViento MagViento
0 2011/07/01 00:00 318 6.6
1 2011/07/01 00:15 342 5.5
2 2011/07/01 00:30 329 6.6
3 2011/07/01 00:45 279 7.5
4 2011/07/01 01:00 318 6.0
5 2011/07/01 01:15 329 7.1
6 2011/07/01 01:30 300 4.7
7 2011/07/01 01:45 291 3.1
How to split the column Fecha in two columns,for example, get a dataframe as follows:
Fecha Hora DirViento MagViento
0 2011/07/01 00:00 318 6.6
1 2011/07/01 00:15 342 5.5
2 2011/07/01 00:30 329 6.6
3 2011/07/01 00:45 279 7.5
4 2011/07/01 01:00 318 6.0
5 2011/07/01 01:15 329 7.1
6 2011/07/01 01:30 300 4.7
7 2011/07/01 01:45 291 3.1
I am using pandas for to read data
I try to calculate daily averages from a monthly database has daily data recorded every 15 minutes. To do this, use pandas and grouped the columns: Date and Time for get a dataframe as follow:
Fecha Hora
2011/07/01 00:00 -4.4
00:15 -1.7
00:30 -3.4
2011/07/02 00:00 -4.5
00:15 -4.2
00:30 -7.6
2011/07/03 00:00 -6.3
00:15 -13.7
00:30 -0.3
with this look, I get the following
grouped.mean()
Fecha DirRes
2011/07/01 -3
2011/07/02 -5
2011/07/03 -6
© Stack Overflow or respective owner