pandas 将DataFrame中的数据转换数据形式

这篇博客介绍了如何利用Python的pandas库,对DataFrame对象进行数据转换操作,包括从5行23列到5行24列的结构调整。
摘要由CSDN通过智能技术生成
import pandas as pd 
file_path = r"C:\Users\Hans\Desktop\data_analysis\test_data\Beijing_2014.csv"
df = pd.read_csv(file_path)
df.head()
Date Temperature(Celsius)(high) Temperature(Celsius)(avg) Temperature(Celsius)(low) Dew Point(Celsius)(high) Dew Point(Celsius)(avg) Dew Point(Celsius)(low) Humidity(%)(high) Humidity(%)(avg) Humidity(%)(low) ... Visibility(km)(high) Visibility(km)(avg) Visibility(km)(low) Wind(km/h)(high) Wind(km/h)(avg) Precipitation(mm)(high) Precipitation(mm)(sum) weather1 weather2 weather3
0 2014-1-1 12 4 -2 -12 -17 -20 44 19 7 ... 31 11 5 32 16 47 0.0 NaN NaN NaN
1 2014-1-2 7 0 -6 -6 -9 -13 74 50 28 ... 18 7 3 18 5 - 0.0 NaN NaN NaN
2 2014-1-3 9 3 -2 -7 -13 -18 64 32 9 ... 31 13 5 18 8 - 0.0 NaN NaN NaN
3 2014-1-4 2 -2 -6 -4 -7 -9 80 68 44 ...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值