.. currentmodule:: pandas .. ipython:: python :suppress: import numpy as np import pandas as pd import os np.random.seed(123456) np.set_printoptions(precision=4, suppress=True) import matplotlib matplotlib.style.use('ggplot') import matplotlib.pyplot as plt pd.options.display.max_rows = 8 dates = pd.date_range('20130101', periods=6) df = pd.DataFrame(np.random.randn(6,4), index=dates, columns=list('ABCD')) Operations ---------- See the :ref:`Basic section on Binary Ops ` Stats ~~~~~ Operations in general *exclude* missing data. Performing a descriptive statistic .. ipython:: python df.mean() Same operation on the other axis .. ipython:: python df.mean(1) Operating with objects that have different dimensionality and need alignment. In addition, pandas automatically broadcasts along the specified dimension. .. ipython:: python s = pd.Series([1,3,5,np.nan,6,8], index=dates).shift(2) s df.sub(s, axis='index') Apply ~~~~~ Applying functions to the data .. ipython:: python df.apply(np.cumsum) df.apply(lambda x: x.max() - x.min()) Histogramming ~~~~~~~~~~~~~ See more at :ref:`Histogramming and Discretization ` .. ipython:: python s = pd.Series(np.random.randint(0, 7, size=100)) s s.value_counts() String Methods ~~~~~~~~~~~~~~ Series is equipped with a set of string processing methods in the `str` attribute that make it easy to operate on each element of the array, as in the code snippet below. Note that pattern-matching in `str` generally uses `regular expressions `__ by default (and in some cases always uses them). See more at :ref:`Vectorized String Methods `. .. ipython:: python s = pd.Series(['A', 'B', 'C', 'Aaba', 'Baca', np.nan, 'CABA', 'dog', 'cat']) s.str.lower()