Py之Pandas:Python的pandas库简介、安装、使用方法详细攻略


爱听歌迎方盒
爱听歌迎方盒 2022-09-20 10:51:08 48991
分类专栏: 资讯

Py之Pandas:Python的pandas库简介、安装、使用方法详细攻略

目录

pandas库简介

pandas库安装

pandas库使用方法

1、函数使用方法

2、使用经验总结

3、绘图相关操作


推荐文章
Py之Pandas:Python的pandas库简介、安装、使用方法详细攻略
Python之pandas:DataFrame二维表的简介、常用函数、常用案例之详细攻略
Python:Python实现读入、写出、复制(自定义函数封装)各自类型如txt、csv等文件之详细攻略
Python之pandas:DataFrame表格数据文件最常用的函数(输出基本信息)集合
Python之Pandas:pandas系列自定义函数封装(将数据表格文件进行横向/纵向拼接、统计每一列不重复类别及其个数)
Python之pandas:DataFrame常用函数(输出基本信息&与字典、统计、映射等相关)案例集合

pandas库简介

      在 Python 自带的科学计算库中,Pandas 模块是最适于数据科学相关操作的工具。它与 Scikit-learn 两个模块几乎提供了数据科学家所需的全部工具。Pandas 是一种开源的、易于使用的数据结构和Python编程语言的数据分析工具。

      根据大多数一线从事机器学习应用的研发人员的经验,如果问他们究竟在机器学习的哪个环节最耗费时间,恐怕多数人会很无奈地回答您:“数据预处理。”。事实上,多数在业界的研发团队往往不会投人太多精力从事全新机器学习模型的研究,而是针对具体的项目和特定的数据,使用现有的经典模型进行分析。这样一来,时间多数被花费在处理数据,甚至是数据清洗的工作上,特别是在数据还相对原始的条件下。Pandas便应运而生,它是一款针对于数据处理和分析的Python工具包,实现了大量便于数据读写、清洗、填充以及分析的功能。这样就帮助研发人员节省了大量用于数据预处理下作的代码,同时也使得他们有更多的精力专注于具体的机器学习任务。


pandas: powerful Python data analysis toolkit
pandas

pandas库安装

pip install pandas

 

pandas库使用方法

1、函数使用方法

Pickling

read_pickle(path[, compression])Load pickled pandas object (or any object) from file.

Flat File

read_table(filepath_or_buffer[, sep, …])(DEPRECATED) Read general delimited file into DataFrame.
read_csv(filepath_or_buffer[, sep, …])Read a comma-separated values (csv) file into DataFrame.
read_fwf(filepath_or_buffer[, colspecs, …])Read a table of fixed-width formatted lines into DataFrame.
read_msgpack(path_or_buf[, encoding, iterator])Load msgpack pandas object from the specified file path

Clipboard

read_clipboard([sep])Read text from clipboard and pass to read_csv.

Excel

read_excel(io[, sheet_name, header, names, …])Read an Excel file into a pandas DataFrame.
ExcelFile.parse([sheet_name, header, names, …])Parse specified sheet(s) into a DataFrame
ExcelWriter(path[, engine, date_format, …])Class for writing DataFrame objects into excel sheets, default is to use xlwt for xls, openpyxl for xlsx.

JSON

read_json([path_or_buf, orient, typ, dtype, …])Convert a JSON string to pandas object.
json_normalize(data[, record_path, meta, …])Normalize semi-structured JSON data into a flat table.
build_table_schema(data[, index, …])Create a Table schema from data.

HTML

read_html(io[, match, flavor, header, …])Read HTML tables into a list of DataFrame objects.

HDFStore: PyTables (HDF5)

read_hdf(path_or_buf[, key, mode])Read from the store, close it if we opened it.
HDFStore.put(key, value[, format, append])Store object in HDFStore
HDFStore.append(key, value[, format, …])Append to Table in file.
HDFStore.get(key)Retrieve pandas object stored in file
HDFStore.select(key[, where, start, stop, …])Retrieve pandas object stored in file, optionally based on where criteria
HDFStore.info()Print detailed information on the store.
HDFStore.keys()Return a (potentially unordered) list of the keys corresponding to the objects stored in the HDFStore.
HDFStore.groups()return a list of all the top-level nodes (that are not themselves a pandas storage object)
HDFStore.walk([where])Walk the pytables group hierarchy for pandas objects

Feather

read_feather(path[, columns, use_threads])Load a feather-format object from the file path

Parquet

read_parquet(path[, engine, columns])Load a parquet object from the file path, returning a DataFrame.

SAS

read_sas(filepath_or_buffer[, format, …])Read SAS files stored as either XPORT or SAS7BDAT format files.

SQL

read_sql_table(table_name, con[, schema, …])Read SQL database table into a DataFrame.
read_sql_query(sql, con[, index_col, …])Read SQL query into a DataFrame.
read_sql(sql, con[, index_col, …])Read SQL query or database table into a DataFrame.

Google BigQuery

read_gbq(query[, project_id, index_col, …])Load data from Google BigQuery.

STATA

read_stata(filepath_or_buffer[, …])Read Stata file into DataFrame.
StataReader.data(**kwargs)(DEPRECATED) Reads observations from Stata file, converting them into a dataframe
StataReader.data_label()Returns data label of Stata file
StataReader.value_labels()Returns a dict, associating each variable name a dict, associating each value its corresponding label
StataReader.variable_labels()Returns variable labels as a dict, associating each variable name with corresponding label
StataWriter.write_file()

2、使用经验总结

Python语言学习之pandas:DataFrame二维表的简介、常用函数、常用案例之详细攻略


 

文章知识点与官方知识档案匹配,可进一步学习相关知识

网站声明:如果转载,请联系本站管理员。否则一切后果自行承担。

本文链接:https://www.xckfsq.com/news/show.html?id=4128
赞同 0
评论 0 条
爱听歌迎方盒L0
粉丝 0 发表 6 + 关注 私信
上周热门
如何使用 StarRocks 管理和优化数据湖中的数据?  2959
【软件正版化】软件正版化工作要点  2878
统信UOS试玩黑神话:悟空  2843
信刻光盘安全隔离与信息交换系统  2737
镜舟科技与中启乘数科技达成战略合作,共筑数据服务新生态  1270
grub引导程序无法找到指定设备和分区  1235
华为全联接大会2024丨软通动力分论坛精彩议程抢先看!  165
点击报名 | 京东2025校招进校行程预告  164
2024海洋能源产业融合发展论坛暨博览会同期活动-海洋能源与数字化智能化论坛成功举办  163
华为纯血鸿蒙正式版9月底见!但Mate 70的内情还得接着挖...  159
本周热议
我的信创开放社区兼职赚钱历程 40
今天你签到了吗? 27
信创开放社区邀请他人注册的具体步骤如下 15
如何玩转信创开放社区—从小白进阶到专家 15
方德桌面操作系统 14
我有15积分有什么用? 13
用抖音玩法闯信创开放社区——用平台宣传企业产品服务 13
如何让你先人一步获得悬赏问题信息?(创作者必看) 12
2024中国信创产业发展大会暨中国信息科技创新与应用博览会 9
中央国家机关政府采购中心:应当将CPU、操作系统符合安全可靠测评要求纳入采购需求 8

加入交流群

请使用微信扫一扫!