|
| 1 | +.. _cookbook: |
| 2 | + |
| 3 | +.. currentmodule:: pandas |
| 4 | + |
| 5 | +.. ipython:: python |
| 6 | + :suppress: |
| 7 | +
|
| 8 | + import numpy as np |
| 9 | + import random |
| 10 | + import os |
| 11 | + np.random.seed(123456) |
| 12 | + from pandas import * |
| 13 | + import pandas as pd |
| 14 | + randn = np.random.randn |
| 15 | + randint = np.random.randint |
| 16 | + np.set_printoptions(precision=4, suppress=True) |
| 17 | +
|
| 18 | +******** |
| 19 | +Cookbook |
| 20 | +******** |
| 21 | + |
| 22 | +This is a respository for *short and sweet* example and links for useful pandas recipes. |
| 23 | +We encourage users to add to this documentation. This is a great *First Pull Request*. |
| 24 | + |
| 25 | +Selection |
| 26 | +--------- |
| 27 | +`Boolean Rows Indexing |
| 28 | +<http://stackoverflow.com/questions/14725068/pandas-using-row-labels-in-boolean-indexing>`__ |
| 29 | + |
| 30 | +`Extending a panel along the minor axis |
| 31 | +<http://stackoverflow.com/questions/15364050/extending-a-pandas-panel-frame-along-the-minor-axis>`__ |
| 32 | + |
| 33 | +`Prepending a level to a multiindex |
| 34 | +<http://stackoverflow.com/questions/14744068/prepend-a-level-to-a-pandas-multiindex>`__ |
| 35 | + |
| 36 | +Grouping |
| 37 | +-------- |
| 38 | + |
| 39 | +`Basic grouping with apply |
| 40 | +<http://stackoverflow.com/questions/15322632/python-pandas-df-groupy-agg-column-reference-in-agg>`__ |
| 41 | + |
| 42 | +`Apply to different items in a group |
| 43 | +<http://stackoverflow.com/questions/15262134/apply-different-functions-to-different-items-in-group-object-python-pandas>`__ |
| 44 | + |
| 45 | +`Replacing values with groupby means |
| 46 | +<http://stackoverflow.com/questions/14760757/replacing-values-with-groupby-means>`__ |
| 47 | + |
| 48 | +`TimeGrouping of values grouped across time |
| 49 | +<http://stackoverflow.com/questions/15297053/how-can-i-divide-single-values-of-a-dataframe-by-monthly-averages>`__ |
| 50 | + |
| 51 | +Merge |
| 52 | +----- |
| 53 | + |
| 54 | +Join |
| 55 | +~~~~ |
| 56 | + |
| 57 | +`Joining a DataFrame to itself |
| 58 | +<https://github.com/pydata/pandas/issues/2996>`__ |
| 59 | + |
| 60 | +Timeseries |
| 61 | +---------- |
| 62 | + |
| 63 | +`Resample intraday frame without adding new days |
| 64 | +<http://stackoverflow.com/questions/14898574/resample-intrday-pandas-dataframe-without-add-new-days>`__ |
| 65 | + |
| 66 | +Data In/Out |
| 67 | +----------- |
| 68 | + |
| 69 | +CSV |
| 70 | +~~~ |
| 71 | + |
| 72 | +HDF5 |
| 73 | +~~~~ |
| 74 | + |
| 75 | +`Managing heteregenous data using a linked multiple table hierarchy |
| 76 | +<https://github.com/pydata/pandas/issues/3032>`__ |
| 77 | + |
| 78 | +`Simple Queries with a Timestamp Index |
| 79 | +<http://stackoverflow.com/questions/13926089/selecting-columns-from-pandas-hdfstore-table>`__ |
| 80 | + |
| 81 | +Miscellaneous |
| 82 | +------------- |
| 83 | + |
| 84 | +`Multi-index sorting |
| 85 | +<http://stackoverflow.com/questions/14733871/mutli-index-sorting-in-pandas>`__ |
0 commit comments