Skip to content

DOC: fix docstrings #10348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/source/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ pandas 0.16.2
This is a minor release from 0.16.1 and includes a large number of bug fixes
along with several new features, enhancements, and performance improvements.

Highlights include:

- A new ``pipe`` method, see :ref:`here <whatsnew_0162.enhancements.pipe>`
- Documentation on how to use `numba <http://numba.pydata.org>`_ with *pandas*, see :ref:`here <enhancingperf.numba>`

See the :ref:`v0.16.2 Whatsnew <whatsnew_0162>` overview for an extensive list
of all enhancements and bugs that have been fixed in 0.16.2.

Expand Down
1 change: 0 additions & 1 deletion doc/source/whatsnew/v0.16.2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Highlights include:
- A new ``pipe`` method, see :ref:`here <whatsnew_0162.enhancements.pipe>`
- Documentation on how to use numba_ with *pandas*, see :ref:`here <enhancingperf.numba>`

Check the :ref:`API Changes <whatsnew_0162.api>` before updating.

.. contents:: What's new in v0.16.2
:local:
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2050,7 +2050,7 @@ def sample(self, n=None, frac=None, replace=False, weights=None, random_state=No
return self.take(locs, axis=axis)

_shared_docs['pipe'] = ("""
Apply func(self, *args, **kwargs)
Apply func(self, \*args, \*\*kwargs)

.. versionadded:: 0.16.2

Expand Down
53 changes: 29 additions & 24 deletions pandas/io/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,34 +640,39 @@ def json_normalize(data, record_path=None, meta=None,
path to records is ['foo', 'bar']
meta_prefix : string, default None

Returns
-------
frame : DataFrame

Examples
--------
data = [{'state': 'Florida',
'shortname': 'FL',
'info': {
'governor': 'Rick Scott'
},
'counties': [{'name': 'Dade', 'population': 12345},
{'name': 'Broward', 'population': 40000},
{'name': 'Palm Beach', 'population': 60000}]},
{'state': 'Ohio',
'shortname': 'OH',
'info': {
'governor': 'John Kasich'
},
'counties': [{'name': 'Summit', 'population': 1234},
{'name': 'Cuyahoga', 'population': 1337}]}]

result = json_normalize(data, 'counties', ['state', 'shortname',
['info', 'governor']])

state governor
Florida Rick Scott

>>> data = [{'state': 'Florida',
... 'shortname': 'FL',
... 'info': {
... 'governor': 'Rick Scott'
... },
... 'counties': [{'name': 'Dade', 'population': 12345},
... {'name': 'Broward', 'population': 40000},
... {'name': 'Palm Beach', 'population': 60000}]},
... {'state': 'Ohio',
... 'shortname': 'OH',
... 'info': {
... 'governor': 'John Kasich'
... },
... 'counties': [{'name': 'Summit', 'population': 1234},
... {'name': 'Cuyahoga', 'population': 1337}]}]
>>> from pandas.io.json import json_normalize
>>> result = json_normalize(data, 'counties', ['state', 'shortname',
... ['info', 'governor']])
>>> result
name population info.governor state shortname
0 Dade 12345 Rick Scott Florida FL
1 Broward 40000 Rick Scott Florida FL
2 Palm Beach 60000 Rick Scott Florida FL
3 Summit 1234 John Kasich Ohio OH
4 Cuyahoga 1337 John Kasich Ohio OH

Returns
-------
frame : DataFrame
"""
def _pull_field(js, spec):
result = js
Expand Down