Skip to main content
`Ctrl`+`K`

# Input/output

Note

For an overview, see IO tools (text, CSV, HDF5, …).

## Pickling

`read_pickle`(filepath_or_buffer[, ...]) | Load pickled pandas object (or any object) from file and return unpickled object.
`DataFrame.to_pickle`(path, *[, compression, ...]) | Pickle (serialize) object to file.

## Flat file

`read_table`(filepath_or_buffer, *[, sep, ...]) | Read general delimited file into DataFrame.
`read_csv`(filepath_or_buffer, *[, sep, ...]) | Read a comma-separated values (csv) file into DataFrame.
`DataFrame.to_csv`([path_or_buf, sep, na_rep, ...]) | Write object to a comma-separated values (csv) file.
`read_fwf`(filepath_or_buffer, *[, colspecs, ...]) | Read a table of fixed-width formatted lines into DataFrame.

`TextFileReader`(f[, engine]) | Iterator over chunks of a delimited text file.
`TextFileReader.read`([nrows]) | Read rows from the file into a `DataFrame`.
`TextFileReader.get_chunk`([size]) | Read the next chunk of rows from the file.
`TextFileReader.close`() | Close the underlying file handle and parser engine.

## Clipboard

`read_clipboard`([sep, dtype_backend]) | Read text from clipboard and pass to `read_csv()`.
`DataFrame.to_clipboard`(*[, excel, sep]) | Copy object to the system clipboard.

## Excel

`read_excel`(io[, sheet_name, header, names, ...]) | Read an Excel file into a `DataFrame`.
`DataFrame.to_excel`(excel_writer, *[, ...]) | Write object to an Excel sheet.
`ExcelFile`(path_or_buffer[, engine, ...]) | Class for parsing tabular Excel sheets into DataFrame objects.
`ExcelFile.book` | Gets the Excel workbook.
`ExcelFile.sheet_names` | Names of the sheets in the document.
`ExcelFile.parse`([sheet_name, header, names, ...]) | (DEPRECATED) Parse specified sheet(s) into a DataFrame.

`Styler.to_excel`(excel_writer[, sheet_name, ...]) | Write Styler to an Excel sheet.

`ExcelWriter`(path[, engine, date_format, ...]) | Class for writing DataFrame objects into excel sheets.

## JSON

`read_json`(path_or_buf, *[, orient, typ, ...]) | Convert a JSON string to pandas object.
`json_normalize`(data[, record_path, meta, ...]) | Normalize semi-structured JSON data into a flat table.
`DataFrame.to_json`([path_or_buf, orient, ...]) | Convert the object to a JSON string.

`build_table_schema`(data[, index, ...]) | Create a Table schema from `data`.

`JsonReader`(filepath_or_buffer, orient, typ, ...) | JsonReader provides an interface for reading in a JSON file.

## HTML

`read_html`(io, *[, match, flavor, header, ...]) | Read HTML tables into a `list` of `DataFrame` objects.
`DataFrame.to_html`([buf, columns, col_space, ...]) | Render a DataFrame as an HTML table.

`Styler.to_html`([buf, table_uuid, ...]) | Write Styler to a file, buffer or string in HTML-CSS format.

## XML

`read_xml`(path_or_buffer, *[, xpath, ...]) | Read XML document into a `DataFrame` object.
`DataFrame.to_xml`([path_or_buffer, index, ...]) | Render a DataFrame to an XML document.

## Latex

`DataFrame.to_latex`([buf, columns, header, ...]) | Render object to a LaTeX tabular, longtable, or nested table.

`Styler.to_latex`([buf, column_format, ...]) | Write Styler to a file, buffer or string in LaTeX format.

## HDFStore: PyTables (HDF5)

`read_hdf`(path_or_buf[, key, mode, errors, ...]) | Read from the store, close it if we opened it.
`HDFStore.put`(key, value[, format, index, ...]) | Store object in HDFStore.
`HDFStore.append`(key, value[, format, axes, ...]) | Append to Table in file.
`HDFStore.append_to_multiple`(d, value, selector) | Append to multiple tables.
`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.select_as_coordinates`(key[, where, ...]) | Return the selection as an Index.
`HDFStore.select_as_multiple`(keys[, where, ...]) | Retrieve pandas objects from multiple tables.
`HDFStore.select_column`(key, column[, start, ...]) | Return a single column from the table.
`HDFStore.remove`(key[, where, start, stop]) | Remove pandas object partially by specifying the where condition.
`HDFStore.create_table_index`(key[, columns, ...]) | Create a pytables index on the table.
`HDFStore.copy`(file[, mode, propindexes, ...]) | Copy the existing store to a new file, updating in place.
`HDFStore.flush`([fsync]) | Force all buffered modifications to be written to disk.
`HDFStore.info`() | Print detailed information on the store.
`HDFStore.is_open` | Return a boolean indicating whether the file is open.
`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.get_storer`(key) | Return the storer object for a key.
`HDFStore.walk`([where]) | Walk the pytables group hierarchy for pandas objects.

Warning

One can store a subclass of `DataFrame` or `Series` to HDF5, but the type of the subclass is lost upon storing.

## Feather

`read_feather`(path[, columns, use_threads, ...]) | Load a feather-format object from the file path.
`DataFrame.to_feather`(path, **kwargs) | Write a DataFrame to the binary Feather format.

## Parquet

`read_parquet`(path[, engine, columns, ...]) | Load a parquet object from the file path, returning a DataFrame.
`DataFrame.to_parquet`([path, engine, ...]) | Write a DataFrame to the binary parquet format.

## Iceberg

`read_iceberg`(table_identifier[, ...]) | Read an Apache Iceberg table into a pandas DataFrame.
`DataFrame.to_iceberg`(table_identifier[, ...]) | Write a DataFrame to an Apache Iceberg table.

Warning

`read_iceberg` is experimental and may change without warning.

## ORC

`read_orc`(path[, columns, dtype_backend, ...]) | Load an ORC object from the file path, returning a DataFrame.
`DataFrame.to_orc`([path, engine, index, ...]) | Write a DataFrame to the Optimized Row Columnar (ORC) format.

## SAS

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

## SPSS

`read_spss`(path[, usecols, ...]) | Load an SPSS file from the file path, returning a DataFrame.

## 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.
`DataFrame.to_sql`(name, con, *[, schema, ...]) | Write records stored in a DataFrame to a SQL database.

## STATA

`read_stata`(filepath_or_buffer, *[, ...]) | Read Stata file into DataFrame.
`DataFrame.to_stata`(path, *[, convert_dates, ...]) | Export DataFrame object to Stata dta format.

`StataReader.data_label` | Return data label of Stata file.
`StataReader.value_labels`() | Return a nested dict associating each variable name to its value and label.
`StataReader.variable_labels`() | Return a dict associating each variable name with corresponding label.
`StataWriter.write_file`() | Export DataFrame object to Stata dta format.