pandas官方文档API参考的读写各类文件的API介绍 (1)(API reference IN&OUTPUT)

来源:互联网 发布:java程序员转正申请 编辑:程序博客网 时间:2024/06/07 13:46

pandas0.20.3
pandas官方文档API参考的读写各类文件的API介绍

写入/写出(Input/Output)

Pickling

read_pickle(path[,compression]):

从指定的路径中读取pickled pandas对象(或任意其他的pickled 对象)

平面文件(flat file)

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

读取通用定界文件到数据框中

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

读取CSV(用逗号分隔)文件到数据框中

read_fwf(filepath_or_buffer[, colspecs, widths])    

读取固定宽度格式的行的表格到数据框中

read_msgpack(path_or_buf[, encoding, iterator])

从指定的路径或缓冲器中载入msgpack的pandas对象

剪贴板(Clipboard)

read_clipboard([sep])

从剪贴板中读取文本然后复制到read_table中

Excel

read_excel(io[, sheetname, header, ...])

读取Excel表格到pandas的数据框中

ExcelFile.parse([sheetname, header, ...])

解析指定的sheet到数据框中

JSON

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

把JSON字符转化为pandas对象

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

把半结构化的JSON数据进行标准化操作使其变为平面表格

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

通过’data’创建一个表格结构

HTML

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

读取HTML表格使其转化为包含数据框的列表对象

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])

把python对象存储为HDFStore

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

添加数据到文件的表中

HDFStore.get(key)

在文件中取回存储的pandas对象

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

基于’where‘参数来选择性地取回在文件中存储的pandas对象

Feather

read_feather(path) 

从文件路径载入feather格式对象

SAS

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

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

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

Google BigQuery

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

从Google BigQuery中载入数据

STATA

read_stata(filepath_or_buffer[, ...])

读取Stata文件到数据框中

StataReader.data(**kwargs)

DEPRECATED:从Stata文件中读取观测值转化到数据框中

StataReader.data_label()

放回Stata文件的数据标签

StataReader.value_labels()

返回一个字典,该字典联合每一个变量名

StataReader.variable_labels()

返回一个可变化标签作为字典,联合每一个变量名

原创粉丝点击