Skip to main content

__ Back to top

__ ` Ctrl ` \+ ` K `

[ ![pandas 2.2.1 documentation - Home](../_static/pandas.svg) ](../index.html)

Site Navigation

  * [ Getting started ](../getting_started/index.html)
  * [ User Guide ](index.html)
  * [ API reference ](../reference/index.html)
  * [ Development ](../development/index.html)
  * [ Release notes ](../whatsnew/index.html)

  * [ __ GitHub  ](https://github.com/pandas-dev/pandas "GitHub")
  * [ __ Twitter  ](https://twitter.com/pandas_dev "Twitter")
  * [ __ Mastodon  ](https://fosstodon.org/@pandas_dev "Mastodon")

Site Navigation

  * [ Getting started ](../getting_started/index.html)
  * [ User Guide ](index.html)
  * [ API reference ](../reference/index.html)
  * [ Development ](../development/index.html)
  * [ Release notes ](../whatsnew/index.html)

  * [ __ GitHub  ](https://github.com/pandas-dev/pandas "GitHub")
  * [ __ Twitter  ](https://twitter.com/pandas_dev "Twitter")
  * [ __ Mastodon  ](https://fosstodon.org/@pandas_dev "Mastodon")

  * 10 minutes to pandas 
  * [ Intro to data structures ](dsintro.html)
  * [ Essential basic functionality ](basics.html)
  * [ IO tools (text, CSV, HDF5, â¦) ](io.html)
  * [ PyArrow Functionality ](pyarrow.html)
  * [ Indexing and selecting data ](indexing.html)
  * [ MultiIndex / advanced indexing ](advanced.html)
  * [ Copy-on-Write (CoW) ](copy_on_write.html)
  * [ Merge, join, concatenate and compare ](merging.html)
  * [ Reshaping and pivot tables ](reshaping.html)
  * [ Working with text data ](text.html)
  * [ Working with missing data ](missing_data.html)
  * [ Duplicate Labels ](duplicates.html)
  * [ Categorical data ](categorical.html)
  * [ Nullable integer data type ](integer_na.html)
  * [ Nullable Boolean data type ](boolean.html)
  * [ Chart visualization ](visualization.html)
  * [ Table Visualization ](style.html)
  * [ Group by: split-apply-combine ](groupby.html)
  * [ Windowing operations ](window.html)
  * [ Time series / date functionality ](timeseries.html)
  * [ Time deltas ](timedeltas.html)
  * [ Options and settings ](options.html)
  * [ Enhancing performance ](enhancingperf.html)
  * [ Scaling to large datasets ](scale.html)
  * [ Sparse data structures ](sparse.html)
  * [ Frequently Asked Questions (FAQ) ](gotchas.html)
  * [ Cookbook ](cookbook.html)

  * [ __ ](../index.html)
  * [ User Guide ](index.html)
  * 10 minutes to pandas 

#  10 minutes to pandas  #

This is a short introduction to pandas, geared mainly for new users. You can
see more complex recipes in the [ Cookbook  ](cookbook.html#cookbook) .

Customarily, we import as follows:

    
    
    In [1]: import numpy as np
    
    In [2]: import pandas as pd
    

##  Basic data structures in pandas  #

Pandas provides two types of classes for handling data:

  1. [ ` Series  ` ](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") : a one-dimensional labeled array holding data of any type 
    

such as integers, strings, Python objects etc.

  2. [ ` DataFrame  ` ](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") : a two-dimensional data structure that holds data like a two-dimension array or a table with rows and columns. 

##  Object creation  #

See the [ Intro to data structures section  ](dsintro.html#dsintro) .

Creating a [ ` Series  ` ](../reference/api/pandas.Series.html#pandas.Series
"pandas.Series") by passing a list of values, letting pandas create a default
[ ` RangeIndex  ` ](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex
"pandas.RangeIndex") .

    
    
    In [3]: s = pd.Series([1, 3, 5, np.nan, 6, 8])
    
    In [4]: s
    Out[4]: 
    0    1.0
    1    3.0
    2    5.0
    3    NaN
    4    6.0
    5    8.0
    dtype: float64
    

Creating a [ ` DataFrame  `
](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame")
by passing a NumPy array with a datetime index using [ ` date_range()  `
](../reference/api/pandas.date_range.html#pandas.