输入/输出#

Pickling#

read_pickle (filepath_or_buffer[, ...])

从文件中加载 pickle 的 pandas 对象(或任何对象)。

DataFrame.to_pickle (path, *[, compression, ...])

将对象 Pickle(序列化)到文件。

平面文件#

read_table (filepath_or_buffer, *[, sep, ...])

将通用分隔文件读取到 DataFrame 中。

read_csv (filepath_or_buffer, *[, sep, ...])

将逗号分隔值 (csv) 文件读取到 DataFrame 中。

DataFrame.to_csv ([path_or_buf, sep, na_rep, ...])

将对象写入逗号分隔值(csv)文件。

read_fwf (filepath_or_buffer, *[, colspecs, ...])

将固定宽度格式化行的表格读入 DataFrame。

剪贴板#

read_clipboard ([sep, dtype_backend])

从剪贴板读取文本并传递给 read_csv()

DataFrame.to_clipboard (*[, excel, sep])

将对象复制到系统剪贴板。

Excel#

read_excel (io[, sheet_name, header, names, ...])

将 Excel 文件读入 pandas DataFrame

DataFrame.to_excel (excel_writer, *[, ...])

将对象写入 Excel 工作表。

ExcelFile (path_or_buffer[, engine, ...])

用于将表格 Excel 工作表解析为 DataFrame 对象的类。

ExcelFile.book

ExcelFile.sheet_names

ExcelFile.parse ([sheet_name, header, names, ...])

将指定的表解析为 DataFrame。

Styler.to_excel (excel_writer[, sheet_name, ...])

将 Styler 写入 Excel 工作表。

ExcelWriter (path[, engine, date_format, ...])

将 DataFrame 对象写入 Excel 工作表的类。

JSON#

read_json (path_or_buf, *[, orient, typ, ...])

将 JSON 字符串转换为 pandas 对象。

json_normalize (data[, record_path, meta, ...])

将半结构化的 JSON 数据规范化为扁平表。

DataFrame.to_json ([path_or_buf, orient, ...])

将对象转换为 JSON 字符串。

build_table_schema (data[, index, ...])

data 创建 Table schema。

HTML#

read_html (io, *[, match, flavor, header, ...])

将 HTML 表格读取到 DataFrame 对象的 list 中。

DataFrame.to_html ([buf, columns, col_space, ...])

将 DataFrame 渲染为 HTML 表。

Styler.to_html ([buf, table_uuid, ...])

将 Styler 以 HTML-CSS 格式写入文件、缓冲区或字符串。

XML#

read_xml (path_or_buffer, *[, xpath, ...])

将 XML 文档读取到 DataFrame 对象中。

DataFrame.to_xml ([path_or_buffer, index, ...])

将DataFrame渲染为XML文档。

LaTeX#

DataFrame.to_latex ([buf, columns, header, ...])

将对象渲染为 LaTeX tabular、longtable 或嵌套表。

Styler.to_latex ([buf, column_format, ...])

将 Styler 以 LaTeX 格式写入文件、缓冲区或字符串。

HDFStore: PyTables (HDF5)#

read_hdf (path_or_buf[, key, mode, errors, ...])

从存储中读取,如果已打开则关闭。

HDFStore.put (key, value[, format, index, ...])

Store object in HDFStore.

HDFStore.append (key, value[, format, axes, ...])

Append to Table in file.

HDFStore.get (key)

Retrieve pandas object stored in file.

HDFStore.select (key[, where, start, stop, ...])

检索文件中存储的 pandas 对象,可选择基于 where 条件。

HDFStore.info ()

Print detailed information on the store.

HDFStore.keys ([include])

Return a list of keys corresponding to objects stored in HDFStore.

HDFStore.groups ()

Return a list of all the top-level nodes.

HDFStore.walk ([where])

遍历 pandas 对象的 pytables 组层次结构。

警告

可以将 DataFrameSeries 的子类存储到 HDF5 中,但在存储时会丢失子类的类型。

Feather#

read_feather (path[, columns, use_threads, ...])

从文件路径加载 feather 格式对象。

DataFrame.to_feather (path, **kwargs)

将 DataFrame 写入二进制 Feather 格式。

Parquet#

read_parquet (path[, engine, columns, ...])

从文件路径加载 parquet 对象,返回一个 DataFrame。

DataFrame.to_parquet ([path, engine, ...])

将 DataFrame 写入二进制 parquet 格式。

ORC#

read_orc (path[, columns, dtype_backend, ...])

从文件路径加载 ORC 对象,返回一个 DataFrame。

DataFrame.to_orc ([path, engine, index, ...])

将 DataFrame 写入 ORC 格式。

SAS#

read_sas (filepath_or_buffer, *[, format, ...])

读取以 XPORT 或 SAS7BDAT 格式存储的 SAS 文件。

SPSS#

read_spss (path[, usecols, ...])

从文件路径加载 SPSS 文件,返回一个 DataFrame。

SQL#

read_sql_table (table_name, con[, schema, ...])

将 SQL 数据库表读入 DataFrame。

read_sql_query (sql, con[, index_col, ...])

将 SQL 查询读入 DataFrame。

read_sql (sql, con[, index_col, ...])

将 SQL 查询或数据库表读取到 DataFrame。

DataFrame.to_sql (name, con, *[, schema, ...])

将存储在 DataFrame 中的记录写入 SQL 数据库。

Google BigQuery#

read_gbq (query[, project_id, index_col, ...])

(已弃用) 从 Google BigQuery 加载数据。

STATA#

read_stata (filepath_or_buffer, *[, ...])

将 Stata 文件读取到 DataFrame 中。

DataFrame.to_stata (path, *[, convert_dates, ...])

将 DataFrame 对象导出为 Stata dta 格式。

StataReader.data_label 

返回 Stata 文件的数据标签。

StataReader.value_labels ()

返回一个嵌套字典,将每个变量名与其值和标签关联起来。

StataReader.variable_labels ()

返回一个字典,将每个变量名与其对应的标签关联起来。

StataWriter.write_file ()

将 DataFrame 对象导出为 Stata dta 格式。