In [1]:
import pandas as pd
import numpy as np
In [10]:
df = pd.DataFrame(np.array([np.random.rand(4)])).T
df['Day']=['Day1','Day2','Day3','Day4']
df.columns=['Precipitation','Day']
df
Out[10]:
Precipitation | Day | |
---|---|---|
0 | 0.154892 | Day1 |
1 | 0.182198 | Day2 |
2 | 0.096904 | Day3 |
3 | 0.384785 | Day4 |
In [12]:
# Change Day to Days and Precipitation to Values
new_nm = {'Precipitation': 'Values',
'Day': 'Weekday'}
df.rename(columns=new_nm,inplace=True)
df
Out[12]:
Values | Weekday | |
---|---|---|
0 | 0.154892 | Day1 |
1 | 0.182198 | Day2 |
2 | 0.096904 | Day3 |
3 | 0.384785 | Day4 |
No comments:
Post a Comment