Skip to content

Commit b0a701e

Browse files
committed
Merge commit 'v0.15.1-108-ge9ee47c' into debian
* commit 'v0.15.1-108-ge9ee47c': (122 commits) BUG: Option context applies on __enter__ CLN: move import to top of file DOC: specify return type in to_datetime Doc change for Issue pandas-dev#8805 Fix unrecognized 'Z' UTC designator BUG CSV: fix problem with trailing whitespace in skipped rows, issues 8661, 8679 ENH CSV: Reduce memory usage when skiprows is an integer in read_csv, issue 8681 DOC: v0.15.2.txt fixups BUG/ENH: cleanup for Timedelta arithmetic COMPAT: windows compat for tests for dtype inference in parser xref (GH8833) DOC: Add Nano to offsets table DOC: Add where and mask to API doc TST: provide a clear argument to assert_produces_warning to guarantee that we are clearing specific warnings before trying to catch them (in case they have already happened) requires the user to specificy the exact class where they are coming BUG: missing nose import for skip test index into multi-index past the lexsort depth BUG: type change breaks BlockManager integrity DOC: Clean up Stata documentation Clarify encoding kwarg on to_csv BUG: fix negative step support for label-based slices BUG: Correct importing behavior for Categoricals in StataReader DOC: api updates for .size ...
2 parents 380fa1d + e9ee47c commit b0a701e

File tree

152 files changed

+18454
-2760
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+18454
-2760
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ matrix:
5454
- JOB_NAME: "34_nslow"
5555
- python: 3.2
5656
env:
57-
- NOSE_ARGS="not slow and not disabled"
57+
- NOSE_ARGS="not slow and not network and not disabled"
5858
- FULL_DEPS=true
5959
- CLIPBOARD_GUI=qt4
6060
- BUILD_TYPE=pydata
@@ -71,7 +71,7 @@ matrix:
7171
allow_failures:
7272
- python: 3.2
7373
env:
74-
- NOSE_ARGS="not slow and not disabled"
74+
- NOSE_ARGS="not slow and not network and not disabled"
7575
- FULL_DEPS=true
7676
- CLIPBOARD_GUI=qt4
7777
- BUILD_TYPE=pydata

ci/requirements-3.2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ tables==3.0.0
99
matplotlib==1.2.1
1010
patsy==0.1.0
1111
lxml==3.2.1
12+
html5lib
1213
scipy==0.12.0
1314
beautifulsoup4==4.2.1
1415
statsmodels==0.5.0

doc/README.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,12 @@ Furthermore, it is recommended to have all `optional dependencies
8888
installed. This is not needed, but be aware that you will see some error
8989
messages. Because all the code in the documentation is executed during the doc
9090
build, the examples using this optional dependencies will generate errors.
91-
Run ``pd.show_version()`` to get an overview of the installed version of all
91+
Run ``pd.show_versions()`` to get an overview of the installed version of all
9292
dependencies.
9393

9494
.. warning::
9595

96-
Building the docs with Sphinx version 1.2 is broken. Use the
97-
latest stable version (1.2.1) or the older 1.1.3.
96+
Sphinx version >= 1.2.2 or the older 1.1.3 is required.
9897

9998
Building pandas
10099
^^^^^^^^^^^^^^^
@@ -133,7 +132,7 @@ If you want to do a full clean build, do::
133132
python make.py build
134133

135134

136-
Staring with 0.13.1 you can tell ``make.py`` to compile only a single section
135+
Starting with 0.13.1 you can tell ``make.py`` to compile only a single section
137136
of the docs, greatly reducing the turn-around time for checking your changes.
138137
You will be prompted to delete `.rst` files that aren't required, since the
139138
last committed version can always be restored from git.

doc/make.py

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,48 +31,48 @@
3131
SPHINX_BUILD = 'sphinxbuild'
3232

3333

34-
def upload_dev():
34+
def upload_dev(user='pandas'):
3535
'push a copy to the pydata dev directory'
36-
if os.system('cd build/html; rsync -avz . pandas@pandas.pydata.org'
37-
':/usr/share/nginx/pandas/pandas-docs/dev/ -essh'):
36+
if os.system('cd build/html; rsync -avz . {0}@pandas.pydata.org'
37+
':/usr/share/nginx/pandas/pandas-docs/dev/ -essh'.format(user)):
3838
raise SystemExit('Upload to Pydata Dev failed')
3939

4040

41-
def upload_dev_pdf():
41+
def upload_dev_pdf(user='pandas'):
4242
'push a copy to the pydata dev directory'
43-
if os.system('cd build/latex; scp pandas.pdf pandas@pandas.pydata.org'
44-
':/usr/share/nginx/pandas/pandas-docs/dev/'):
43+
if os.system('cd build/latex; scp pandas.pdf {0}@pandas.pydata.org'
44+
':/usr/share/nginx/pandas/pandas-docs/dev/'.format(user)):
4545
raise SystemExit('PDF upload to Pydata Dev failed')
4646

4747

48-
def upload_stable():
48+
def upload_stable(user='pandas'):
4949
'push a copy to the pydata stable directory'
50-
if os.system('cd build/html; rsync -avz . pandas@pandas.pydata.org'
51-
':/usr/share/nginx/pandas/pandas-docs/stable/ -essh'):
50+
if os.system('cd build/html; rsync -avz . {0}@pandas.pydata.org'
51+
':/usr/share/nginx/pandas/pandas-docs/stable/ -essh'.format(user)):
5252
raise SystemExit('Upload to stable failed')
5353

5454

55-
def upload_stable_pdf():
55+
def upload_stable_pdf(user='pandas'):
5656
'push a copy to the pydata dev directory'
57-
if os.system('cd build/latex; scp pandas.pdf pandas@pandas.pydata.org'
58-
':/usr/share/nginx/pandas/pandas-docs/stable/'):
57+
if os.system('cd build/latex; scp pandas.pdf {0}@pandas.pydata.org'
58+
':/usr/share/nginx/pandas/pandas-docs/stable/'.format(user)):
5959
raise SystemExit('PDF upload to stable failed')
6060

6161

62-
def upload_prev(ver, doc_root='./'):
62+
def upload_prev(ver, doc_root='./', user='pandas'):
6363
'push a copy of older release to appropriate version directory'
6464
local_dir = doc_root + 'build/html'
6565
remote_dir = '/usr/share/nginx/pandas/pandas-docs/version/%s/' % ver
66-
cmd = 'cd %s; rsync -avz . pandas@pandas.pydata.org:%s -essh'
67-
cmd = cmd % (local_dir, remote_dir)
66+
cmd = 'cd %s; rsync -avz . %s@pandas.pydata.org:%s -essh'
67+
cmd = cmd % (local_dir, user, remote_dir)
6868
print(cmd)
6969
if os.system(cmd):
7070
raise SystemExit(
7171
'Upload to %s from %s failed' % (remote_dir, local_dir))
7272

7373
local_dir = doc_root + 'build/latex'
74-
pdf_cmd = 'cd %s; scp pandas.pdf pandas@pandas.pydata.org:%s'
75-
pdf_cmd = pdf_cmd % (local_dir, remote_dir)
74+
pdf_cmd = 'cd %s; scp pandas.pdf %s@pandas.pydata.org:%s'
75+
pdf_cmd = pdf_cmd % (local_dir, user, remote_dir)
7676
if os.system(pdf_cmd):
7777
raise SystemExit('Upload PDF to %s from %s failed' % (ver, doc_root))
7878

@@ -337,6 +337,10 @@ def generate_index(api=True, single=False, **kwds):
337337
type=str,
338338
default=False,
339339
help='filename of section to compile, e.g. "indexing"')
340+
argparser.add_argument('--user',
341+
type=str,
342+
default=False,
343+
help='Username to connect to the pydata server')
340344

341345
def main():
342346
args, unknown = argparser.parse_known_args()
@@ -354,16 +358,19 @@ def main():
354358
ver = sys.argv[2]
355359

356360
if ftype == 'build_previous':
357-
build_prev(ver)
361+
build_prev(ver, user=args.user)
358362
if ftype == 'upload_previous':
359-
upload_prev(ver)
363+
upload_prev(ver, user=args.user)
360364
elif len(sys.argv) == 2:
361365
for arg in sys.argv[1:]:
362366
func = funcd.get(arg)
363367
if func is None:
364368
raise SystemExit('Do not know how to handle %s; valid args are %s' % (
365369
arg, list(funcd.keys())))
366-
func()
370+
if args.user:
371+
func(user=args.user)
372+
else:
373+
func()
367374
else:
368375
small_docs = False
369376
all()

doc/source/api.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ Standard moving window functions
190190
rolling_quantile
191191
rolling_window
192192

193+
.. _api.functions_expanding:
194+
193195
Standard expanding window functions
194196
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
195197

@@ -248,9 +250,9 @@ Attributes
248250
Series.dtype
249251
Series.ftype
250252
Series.shape
251-
Series.size
252253
Series.nbytes
253254
Series.ndim
255+
Series.size
254256
Series.strides
255257
Series.itemsize
256258
Series.base
@@ -392,6 +394,8 @@ Reindexing / Selection / Label manipulation
392394
Series.take
393395
Series.tail
394396
Series.truncate
397+
Series.where
398+
Series.mask
395399

396400
Missing data handling
397401
~~~~~~~~~~~~~~~~~~~~~
@@ -652,6 +656,7 @@ Attributes and underlying data
652656
DataFrame.values
653657
DataFrame.axes
654658
DataFrame.ndim
659+
DataFrame.size
655660
DataFrame.shape
656661

657662
Conversion
@@ -686,6 +691,8 @@ Indexing, iteration
686691
DataFrame.tail
687692
DataFrame.xs
688693
DataFrame.isin
694+
DataFrame.where
695+
DataFrame.mask
689696
DataFrame.query
690697

691698
For more information on ``.at``, ``.iat``, ``.ix``, ``.loc``, and
@@ -919,6 +926,7 @@ Attributes and underlying data
919926
Panel.values
920927
Panel.axes
921928
Panel.ndim
929+
Panel.size
922930
Panel.shape
923931
Panel.dtypes
924932
Panel.ftypes
@@ -1126,6 +1134,7 @@ Attributes and underlying data
11261134
Panel4D.values
11271135
Panel4D.axes
11281136
Panel4D.ndim
1137+
Panel4D.size
11291138
Panel4D.shape
11301139
Panel4D.dtypes
11311140
Panel4D.ftypes
@@ -1164,14 +1173,16 @@ Attributes
11641173

11651174
Index.values
11661175
Index.is_monotonic
1176+
Index.is_monotonic_increasing
1177+
Index.is_monotonic_decreasing
11671178
Index.is_unique
11681179
Index.dtype
11691180
Index.inferred_type
11701181
Index.is_all_dates
11711182
Index.shape
1172-
Index.size
11731183
Index.nbytes
11741184
Index.ndim
1185+
Index.size
11751186
Index.strides
11761187
Index.itemsize
11771188
Index.base

doc/source/categorical.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ which are removed are replaced by ``np.nan``.:
236236
s = s.cat.remove_categories([4])
237237
s
238238
239-
Renaming unused categories
239+
Removing unused categories
240240
~~~~~~~~~~~~~~~~~~~~~~~~~~
241241

242242
Removing unused categories can also be done:
@@ -541,8 +541,13 @@ The same applies to ``df.append(df_different)``.
541541
Getting Data In/Out
542542
-------------------
543543

544-
Writing data (`Series`, `Frames`) to a HDF store that contains a ``category`` dtype will currently
545-
raise ``NotImplementedError``.
544+
.. versionadded:: 0.15.2
545+
546+
Writing data (`Series`, `Frames`) to a HDF store that contains a ``category`` dtype was implemented
547+
in 0.15.2. See :ref:`here <io.hdf5-categorical>` for an example and caveats.
548+
549+
Writing data to and reading data from *Stata* format files was implemented in
550+
0.15.2. See :ref:`here <io.stata-categorical>` for an example and caveats.
546551

547552
Writing to a CSV file will convert the data, effectively removing any information about the
548553
categorical (categories and ordering). So if you read back the CSV file you have to convert the
@@ -573,6 +578,7 @@ relevant columns back to `category` and assign the right categories and categori
573578
df2.dtypes
574579
df2["cats"]
575580
581+
The same holds for writing to a SQL database with ``to_sql``.
576582

577583
Missing Data
578584
------------
@@ -804,4 +810,3 @@ Use ``copy=True`` to prevent such a behaviour or simply don't reuse `Categorical
804810
This also happens in some cases when you supply a `numpy` array instead of a `Categorical`:
805811
using an int array (e.g. ``np.array([1,2,3,4])``) will exhibit the same behaviour, while using
806812
a string array (e.g. ``np.array(["a","b","c","a"])``) will not.
807-

doc/source/conf.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,9 @@
4444
'ipython_sphinxext.ipython_directive',
4545
'ipython_sphinxext.ipython_console_highlighting',
4646
'sphinx.ext.intersphinx',
47-
'sphinx.ext.todo',
4847
'sphinx.ext.coverage',
4948
'sphinx.ext.pngmath',
5049
'sphinx.ext.ifconfig',
51-
'matplotlib.sphinxext.only_directives',
52-
'matplotlib.sphinxext.plot_directive',
5350
]
5451

5552

doc/source/cookbook.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,19 @@ Unlike agg, apply's callable is passed a sub-DataFrame which gives you access to
588588
df['beyer_shifted'] = df.groupby(level=0)['beyer'].shift(1)
589589
df
590590
591+
`Select row with maximum value from each group
592+
<http://stackoverflow.com/q/26701849/190597>`__
593+
594+
.. ipython:: python
595+
596+
df = pd.DataFrame({'host':['other','other','that','this','this'],
597+
'service':['mail','web','mail','mail','web'],
598+
'no':[1, 2, 1, 2, 1]}).set_index(['host', 'service'])
599+
mask = df.groupby(level=0).agg('idxmax')
600+
df_count = df.loc[mask['no']].reset_index()
601+
df_count
602+
603+
591604
Expanding Data
592605
**************
593606

@@ -1202,4 +1215,4 @@ of the data values:
12021215
{'height': [60, 70],
12031216
'weight': [100, 140, 180],
12041217
'sex': ['Male', 'Female']})
1205-
df
1218+
df

doc/source/faq.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ when calling ``df.info()``:
5050
5151
df.info()
5252
53+
The ``+`` symbol indicates that the true memory usage could be higher, because
54+
pandas does not count the memory used by values in columns with
55+
``dtype=object``.
56+
5357
By default the display option is set to ``True`` but can be explicitly
5458
overridden by passing the ``memory_usage`` argument when invoking ``df.info()``.
5559

doc/source/groupby.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,21 @@ In the case of grouping by multiple keys, the group name will be a tuple:
338338
It's standard Python-fu but remember you can unpack the tuple in the for loop
339339
statement if you wish: ``for (k1, k2), group in grouped:``.
340340

341+
Selecting a group
342+
-----------------
343+
344+
A single group can be selected using ``GroupBy.get_group()``:
345+
346+
.. ipython:: python
347+
348+
grouped.get_group('bar')
349+
350+
Or for an object grouped on multiple columns:
351+
352+
.. ipython:: python
353+
354+
df.groupby(['A', 'B']).get_group(('bar', 'one'))
355+
341356
.. _groupby.aggregate:
342357

343358
Aggregation

0 commit comments

Comments
 (0)