Favicon of pandas

pandas

Python library providing the DataFrame and Series structures used for cleaning, merging, and analyzing tabular and time series data.

pandas is an open-source Python library for working with structured, labeled data such as tables, spreadsheets, and time series. It provides the DataFrame and Series data structures that most tabular data analysis in Python is built on top of, aiming to be the fundamental building block for practical, real-world data work in the language. It's aimed at data analysts, data scientists, and engineers who need to clean, manipulate, merge, or explore tabular data, from quick exploratory scripts run in a notebook to production data pipelines that run on a schedule.

Key features

  • DataFrame and Series: labeled, size-mutable data structures for tabular and one-dimensional data, with columns that can be inserted and deleted freely as your analysis evolves.
  • Missing data handling: consistent handling of missing values, represented as NaN, NA, or NaT, across both floating-point and non-floating-point data.
  • Data alignment: automatic and explicit alignment of data by label, so operations line up correctly even when indexes don't match exactly, or so you can ignore labels and let pandas handle the alignment for you.
  • Group by: split-apply-combine operations for aggregating, combining, and summarizing grouped data across a dataset.
  • Merging and joining: database-style joins and merges between datasets, similar to SQL joins, plus easy conversion of ragged, differently-indexed data from other Python and NumPy structures into DataFrames.
  • Intelligent slicing and indexing: label-based slicing, fancy indexing, and boolean subsetting for working with large datasets.
  • Reshaping and pivoting: tools for reshaping datasets and building pivot tables, plus hierarchical (MultiIndex) labeling for multiple labels per axis tick.
  • I/O tools: readers and writers for CSV and other delimited files, Excel files, SQL databases, and the ultrafast HDF5 format.
  • Time series support: date range generation, frequency conversion, moving window statistics, and date shifting and lagging.

Ideal use cases

pandas is a strong fit for cleaning and reshaping messy tabular data (CSV exports, Excel files, SQL query results) before analysis, and for exploratory data analysis where you need to slice, group, and aggregate a dataset quickly. It also handles time series work well, including resampling and rolling-window calculations, which shows up often in finance and operations analytics; pandas itself started at a quantitative hedge fund in 2008 and has been under active development since. It's equally useful as the data-wrangling layer inside a larger Python application, feeding cleaned data into a model, a report, or a dashboard.

It's not the right tool when a dataset is far larger than available memory, since pandas operates in memory rather than out-of-core or distributed by default; at that scale, tools built for distributed processing are a better match. It's also a programming library, not a GUI application, so it assumes you're comfortable writing Python rather than clicking through an interface, and it expects some familiarity with NumPy-style array thinking to get the most out of it.

Installation

The standard way to install pandas is from PyPI or Conda:

# conda
conda install -c conda-forge pandas
# or PyPI
pip install pandas

Required dependencies are NumPy and python-dateutil; tzdata is additionally required on Windows and Emscripten. To install from source instead, Cython is needed in addition to the normal dependencies:

pip install cython

Then, from the pandas directory (the same one this README lives in after cloning the repository):

pip install .

Or for an editable, development install, which is useful if you're contributing to pandas itself:

python -m pip install -ve . --no-build-isolation --config-settings editable-verbose=true

The official documentation covers the minimum supported versions of required, recommended, and optional dependencies in more detail than this README does.

Tags:

Frequently asked questions

Share:

Stars
49.2K
Forks
20.1K
Last commit
3 hours ago
Repository age
16 years
License
BSD-3-Clause
Self-hosted
No
Activity score
88/100
View Repository
Built with:

Similar to pandas

Favicon

 

  
  
Favicon

 

  
  
Favicon