Py之Pandas:Python的pandas库简介、安装、使用方法详细攻略
目录
pandas库简介
pandas库安装
pandas库使用方法
1、函数使用方法
2、使用经验总结
3、绘图相关操作
pandas库简介
在 Python 自带的科学计算库中,Pandas 模块是最适于数据科学相关操作的工具。它与 Scikit-learn 两个模块几乎提供了数据科学家所需的全部工具。Pandas 是一种开源的、易于使用的数据结构和Python编程语言的数据分析工具。
根据大多数一线从事机器学习应用的研发人员的经验,如果问他们究竟在机器学习的哪个环节最耗费时间,恐怕多数人会很无奈地回答您:“数据预处理。”。事实上,多数在业界的研发团队往往不会投人太多精力从事全新机器学习模型的研究,而是针对具体的项目和特定的数据,使用现有的经典模型进行分析。这样一来,时间多数被花费在处理数据,甚至是数据清洗的工作上,特别是在数据还相对原始的条件下。Pandas便应运而生,它是一款针对于数据处理和分析的Python工具包,实现了大量便于数据读写、清洗、填充以及分析的功能。这样就帮助研发人员节省了大量用于数据预处理下作的代码,同时也使得他们有更多的精力专注于具体的机器学习任务。
pandas: powerful Python data analysis toolkit
pandas
pandas库安装
pip install pandas
pandas库使用方法
1、函数使用方法
Pickling
| Load pickled pandas object (or any object) from file. |
Flat File
| (DEPRECATED) Read general delimited file into DataFrame. |
| Read a comma-separated values (csv) file into DataFrame. |
| Read a table of fixed-width formatted lines into DataFrame. |
| Load msgpack pandas object from the specified file path |
Clipboard
| Read text from clipboard and pass to read_csv. |
Excel
| Read an Excel file into a pandas DataFrame. |
| Parse specified sheet(s) into a DataFrame |
| Class for writing DataFrame objects into excel sheets, default is to use xlwt for xls, openpyxl for xlsx. |
JSON
| Convert a JSON string to pandas object. |
| Normalize semi-structured JSON data into a flat table. |
| Create a Table schema from |
HTML
| Read HTML tables into a |
HDFStore: PyTables (HDF5)
| Read from the store, close it if we opened it. |
| Store object in HDFStore |
| Append to Table in file. |
| Retrieve pandas object stored in file |
| Retrieve pandas object stored in file, optionally based on where criteria |
| Print detailed information on the store. |
| Return a (potentially unordered) list of the keys corresponding to the objects stored in the HDFStore. |
| return a list of all the top-level nodes (that are not themselves a pandas storage object) |
| Walk the pytables group hierarchy for pandas objects |
Feather
| Load a feather-format object from the file path |
Parquet
| Load a parquet object from the file path, returning a DataFrame. |
SAS
| Read SAS files stored as either XPORT or SAS7BDAT format files. |
SQL
| Read SQL database table into a DataFrame. |
| Read SQL query into a DataFrame. |
| Read SQL query or database table into a DataFrame. |
Google BigQuery
| Load data from Google BigQuery. |
STATA
| Read Stata file into DataFrame. |
| (DEPRECATED) Reads observations from Stata file, converting them into a dataframe |
| Returns data label of Stata file |
| Returns a dict, associating each variable name a dict, associating each value its corresponding label |
| Returns variable labels as a dict, associating each variable name with corresponding label |
|
2、使用经验总结
Python语言学习之pandas:DataFrame二维表的简介、常用函数、常用案例之详细攻略