1、首先加载pandas模块
import pandas
2、然后创建一个DataFrame
df = pd.DataFrame(data=None, index=None, columns=None, dtype=None, copy=False)
3、初始化一个DataFrame。
该DataFrame将作为样例,用于下面的讲解:
data = {
'性别':['male','male','female','male'],
'姓名':['汤师爷','县长','县长夫人','黄老爷'],
'年龄':[40,35,25,44]}
df = pd.DataFrame(data,index=['one','two','three','four'],
columns=['姓名','性别','年龄','职业'])
4、在命令行输入df ,即可看到当前DataFrame的内容。
以上就是python中pandas模块查看DataFrame的方法,希望对大家有所帮助。更多Python学习指路:python基础教程
本文教程操作环境:windows7系统、Python 3.9.1,DELL G3电脑。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有