您好,欢迎来到要发发知识网。
搜索
您的当前位置:首页python中pandas模块查看DataFrame

python中pandas模块查看DataFrame

来源:要发发知识网

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学习指路:

本文教程操作环境:windows7系统、Python 3.9.1,DELL G3电脑。

Copyright © 2019- net188.cn 版权所有 湘ICP备2022005869号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务