Skip to content

Commit 5d785c3

Browse files
committed
Merge remote-tracking branch 'repo_org/master' into check_np_pd_fromExamples
* repo_org/master: (66 commits) CLN: doc string (pandas-dev#23469) DOC: Add cookbook entry for triangular correlation matrix (GH22840) (pandas-dev#23032) add number of Errors, Warnings to scripts/validate_docstrings.py (pandas-dev#23150) BUG: Allow freq conversion from dt64 to period (pandas-dev#23460) ENH: Add FrozenList.union and .difference (pandas-dev#23394) REF: cython cleanup, typing, optimizations (pandas-dev#23464) strictness and checks for Timedelta _simple_new (pandas-dev#23433) Fixing flake8 problems new to flake8 3.6.0 (pandas-dev#23472) DOC: Updating the docstring of Series.dot (pandas-dev#22890) TST: Fixturize series/test_analytics.py (pandas-dev#22755) BUG/ENH: Handle NonexistentTimeError in date rounding (pandas-dev#23406) PERF: speed up concat on Series by making _get_axis_number() a classmethod (pandas-dev#23404) REF: Remove DatetimelikeArrayMixin._shallow_copy (pandas-dev#23430) REF: strictness/simplification in DatetimeArray/Index _simple_new (pandas-dev#23431) REF: cython cleanup, typing, optimizations (pandas-dev#23456) TST: tweak Hypothesis configuration and idioms (pandas-dev#23441) BUG: fix HDFStore.append with all empty strings error (GH12242) (pandas-dev#23435) TST: Skip 32bit failing IntervalTree tests (pandas-dev#23442) BUG: Deprecate nthreads argument (pandas-dev#23112) style: fix import format at pandas/core/reshape (pandas-dev#23387) ...
2 parents d824414 + d78bd7a commit 5d785c3

File tree

385 files changed

+4766
-4207
lines changed

Some content is hidden

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

385 files changed

+4766
-4207
lines changed

ci/azure-36-locale_slow.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
- nomkl
1515
- numexpr
1616
- numpy
17-
- openpyxl=2.5.5
17+
- openpyxl
1818
- psycopg2
1919
- pymysql
2020
- pytables

ci/azure-37-locale.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dependencies:
1313
- nomkl
1414
- numexpr
1515
- numpy
16-
- openpyxl=2.5.5
16+
- openpyxl
1717
- psycopg2
1818
- pymysql
1919
- pytables

ci/azure-macos-35.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies:
1212
- nomkl
1313
- numexpr
1414
- numpy=1.12.0
15-
- openpyxl=2.5.5
15+
- openpyxl
1616
- pytables
1717
- python=3.5*
1818
- pytz

ci/azure-windows-27.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dependencies:
1313
- matplotlib=2.0.1
1414
- numexpr
1515
- numpy=1.12*
16-
- openpyxl=2.5.5
16+
- openpyxl
1717
- pytables
1818
- python=2.7.*
1919
- pytz

ci/azure-windows-36.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ dependencies:
77
- bottleneck
88
- boost-cpp<1.67
99
- fastparquet
10-
- feather-format
1110
- matplotlib
1211
- numexpr
1312
- numpy=1.14*
14-
- openpyxl=2.5.5
13+
- openpyxl
1514
- parquet-cpp
1615
- pyarrow
1716
- pytables

ci/azure/windows-py27.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
displayName: 'Build'
3838
- script: |
3939
call activate %CONDA_ENV%
40-
pytest --junitxml=test-data.xml --skip-slow --skip-network pandas -n 2 -r sxX --strict %*
40+
pytest --junitxml=test-data.xml --skip-slow --skip-network pandas -n 2 -r sxX --strict --durations=10 %*
4141
displayName: 'Test'
4242
- task: PublishTestResults@2
4343
inputs:

ci/azure/windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
displayName: 'Build'
2929
- script: |
3030
call activate %CONDA_ENV%
31-
pytest --junitxml=test-data.xml --skip-slow --skip-network pandas -n 2 -r sxX --strict %*
31+
pytest --junitxml=test-data.xml --skip-slow --skip-network pandas -n 2 -r sxX --strict --durations=10 %*
3232
displayName: 'Test'
3333
- task: PublishTestResults@2
3434
inputs:

ci/circle-36-locale.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dependencies:
1313
- nomkl
1414
- numexpr
1515
- numpy
16-
- openpyxl=2.5.5
16+
- openpyxl
1717
- psycopg2
1818
- pymysql
1919
- pytables

ci/circle/run_circle.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ export PATH="$MINICONDA_DIR/bin:$PATH"
55

66
source activate pandas
77

8-
echo "pytest --strict --junitxml=$CIRCLE_TEST_REPORTS/reports/junit.xml $@ pandas"
9-
pytest --strict --color=no --junitxml=$CIRCLE_TEST_REPORTS/reports/junit.xml $@ pandas
8+
echo "pytest --strict --durations=10 --color=no --junitxml=$CIRCLE_TEST_REPORTS/reports/junit.xml $@ pandas"
9+
pytest --strict --durations=10 --color=no --junitxml=$CIRCLE_TEST_REPORTS/reports/junit.xml $@ pandas

ci/requirements-optional-conda.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ beautifulsoup4>=4.2.1
22
blosc
33
bottleneck>=1.2.0
44
fastparquet
5-
feather-format
65
gcsfs
76
html5lib
87
ipython>=5.6.0
@@ -12,8 +11,8 @@ lxml
1211
matplotlib>=2.0.0
1312
nbsphinx
1413
numexpr>=2.6.1
15-
openpyxl=2.5.5
16-
pyarrow
14+
openpyxl
15+
pyarrow>=0.4.1
1716
pymysql
1817
pytables>=3.4.2
1918
pytest-cov

ci/requirements-optional-pip.txt

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ beautifulsoup4>=4.2.1
44
blosc
55
bottleneck>=1.2.0
66
fastparquet
7-
feather-format
87
gcsfs
98
html5lib
109
ipython>=5.6.0
@@ -14,8 +13,8 @@ lxml
1413
matplotlib>=2.0.0
1514
nbsphinx
1615
numexpr>=2.6.1
17-
openpyxl==2.5.5
18-
pyarrow
16+
openpyxl
17+
pyarrow>=0.4.1
1918
pymysql
2019
tables
2120
pytest-cov
@@ -28,4 +27,4 @@ statsmodels
2827
xarray
2928
xlrd
3029
xlsxwriter
31-
xlwt
30+
xlwt

ci/script_multi.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ if [ "$DOC" ]; then
2727
echo "We are not running pytest as this is a doc-build"
2828

2929
elif [ "$COVERAGE" ]; then
30-
echo pytest -s -n 2 -m "not single" --cov=pandas --cov-report xml:/tmp/cov-multiple.xml --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
31-
pytest -s -n 2 -m "not single" --cov=pandas --cov-report xml:/tmp/cov-multiple.xml --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
30+
echo pytest -s -n 2 -m "not single" --durations=10 --cov=pandas --cov-report xml:/tmp/cov-multiple.xml --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
31+
pytest -s -n 2 -m "not single" --durations=10 --cov=pandas --cov-report xml:/tmp/cov-multiple.xml --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
3232

3333
elif [ "$SLOW" ]; then
3434
TEST_ARGS="--only-slow --skip-network"
35-
echo pytest -m "not single and slow" -v --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
36-
pytest -m "not single and slow" -v --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
35+
echo pytest -m "not single and slow" -v --durations=10 --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
36+
pytest -m "not single and slow" -v --durations=10 --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
3737

3838
else
39-
echo pytest -n 2 -m "not single" --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
40-
pytest -n 2 -m "not single" --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas # TODO: doctest
39+
echo pytest -n 2 -m "not single" --durations=10 --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
40+
pytest -n 2 -m "not single" --durations=10 --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas # TODO: doctest
4141

4242
fi
4343

ci/script_single.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ if [ "$DOC" ]; then
2626
echo "We are not running pytest as this is a doc-build"
2727

2828
elif [ "$COVERAGE" ]; then
29-
echo pytest -s -m "single" --strict --cov=pandas --cov-report xml:/tmp/cov-single.xml --junitxml=test-data-single.xml $TEST_ARGS pandas
30-
pytest -s -m "single" --strict --cov=pandas --cov-report xml:/tmp/cov-single.xml --junitxml=test-data-single.xml $TEST_ARGS pandas
29+
echo pytest -s -m "single" --durations=10 --strict --cov=pandas --cov-report xml:/tmp/cov-single.xml --junitxml=test-data-single.xml $TEST_ARGS pandas
30+
pytest -s -m "single" --durations=10 --strict --cov=pandas --cov-report xml:/tmp/cov-single.xml --junitxml=test-data-single.xml $TEST_ARGS pandas
3131
echo pytest -s --strict scripts
3232
pytest -s --strict scripts
3333
else
34-
echo pytest -m "single" --junitxml=test-data-single.xml --strict $TEST_ARGS pandas
35-
pytest -m "single" --junitxml=test-data-single.xml --strict $TEST_ARGS pandas
34+
echo pytest -m "single" --durations=10 --junitxml=test-data-single.xml --strict $TEST_ARGS pandas
35+
pytest -m "single" --durations=10 --junitxml=test-data-single.xml --strict $TEST_ARGS pandas
3636

3737
fi
3838

ci/travis-27.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ dependencies:
77
- bottleneck
88
- cython=0.28.2
99
- fastparquet
10-
- feather-format
1110
- gcsfs
1211
- html5lib
1312
- ipython
@@ -35,7 +34,7 @@ dependencies:
3534
- s3fs
3635
- scipy
3736
- sqlalchemy=0.9.6
38-
- xarray=0.8.0
37+
- xarray=0.9.6
3938
- xlrd=0.9.2
4039
- xlsxwriter=0.5.2
4140
- xlwt=0.7.5

ci/travis-36-doc.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ dependencies:
88
- bottleneck
99
- cython>=0.28.2
1010
- fastparquet
11-
- feather-format
1211
- html5lib
1312
- hypothesis>=3.58.0
1413
- ipykernel
@@ -22,8 +21,9 @@ dependencies:
2221
- notebook
2322
- numexpr
2423
- numpy=1.13*
25-
- openpyxl=2.5.5
24+
- openpyxl
2625
- pandoc
26+
- pyarrow
2727
- pyqt
2828
- pytables
2929
- python-dateutil

ci/travis-36-slow.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies:
1010
- matplotlib
1111
- numexpr
1212
- numpy
13-
- openpyxl=2.5.5
13+
- openpyxl
1414
- patsy
1515
- psycopg2
1616
- pymysql

ci/travis-36.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ dependencies:
77
- cython>=0.28.2
88
- dask
99
- fastparquet
10-
- feather-format
1110
- flake8>=3.5
1211
- flake8-comprehensions
1312
- gcsfs
@@ -21,9 +20,9 @@ dependencies:
2120
- nomkl
2221
- numexpr
2322
- numpy
24-
- openpyxl=2.5.5
23+
- openpyxl
2524
- psycopg2
26-
- pyarrow
25+
- pyarrow=0.9.0
2726
- pymysql
2827
- pytables
2928
- python-snappy

ci/travis-37.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dependencies:
99
- numpy
1010
- python-dateutil
1111
- nomkl
12+
- pyarrow
1213
- pytz
1314
- pytest
1415
- pytest-xdist

doc/source/advanced.rst

+41
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,47 @@ method, allowing you to permute the hierarchical index levels in one step:
503503
504504
df[:5].reorder_levels([1,0], axis=0)
505505
506+
.. _advanced.index_names:
507+
508+
Renaming names of an ``Index`` or ``MultiIndex``
509+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
510+
511+
The :meth:`~DataFrame.rename` method is used to rename the labels of a
512+
``MultiIndex``, and is typically used to rename the columns of a ``DataFrame``.
513+
The ``columns`` argument of ``rename`` allows a dictionary to be specified
514+
that includes only the columns you wish to rename.
515+
516+
.. ipython:: python
517+
518+
df.rename(columns={0: "col0", 1: "col1"})
519+
520+
This method can also be used to rename specific labels of the main index
521+
of the ``DataFrame``.
522+
523+
.. ipython:: python
524+
525+
df.rename(index={"one" : "two", "y" : "z"})
526+
527+
The :meth:`~DataFrame.rename_axis` method is used to rename the name of a
528+
``Index`` or ``MultiIndex``. In particular, the names of the levels of a
529+
``MultiIndex`` can be specified, which is useful if ``reset_index()`` is later
530+
used to move the values from the ``MultiIndex`` to a column.
531+
532+
.. ipython:: python
533+
534+
df.rename_axis(index=['abc', 'def'])
535+
536+
Note that the columns of a ``DataFrame`` are an index, so that using
537+
``rename_axis`` with the ``columns`` argument will change the name of that
538+
index.
539+
540+
.. ipython:: python
541+
542+
df.rename_axis(columns="Cols").columns
543+
544+
Both ``rename`` and ``rename_axis`` support specifying a dictionary,
545+
``Series`` or a mapping function to map labels/names to new values.
546+
506547
Sorting a ``MultiIndex``
507548
------------------------
508549

doc/source/api.rst

+56-1
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,6 @@ Reshaping, sorting
515515
Series.repeat
516516
Series.squeeze
517517
Series.view
518-
Series.sortlevel
519518

520519

521520
Combining / joining / merging
@@ -2105,6 +2104,62 @@ Methods
21052104
Timedelta.to_timedelta64
21062105
Timedelta.total_seconds
21072106

2107+
.. _api.dateoffsets:
2108+
2109+
Date Offsets
2110+
------------
2111+
2112+
.. currentmodule:: pandas.tseries.offsets
2113+
2114+
.. autosummary::
2115+
:toctree: generated/
2116+
2117+
DateOffset
2118+
BusinessDay
2119+
BusinessHour
2120+
CustomBusinessDay
2121+
CustomBusinessHour
2122+
MonthOffset
2123+
MonthEnd
2124+
MonthBegin
2125+
BusinessMonthEnd
2126+
BusinessMonthBegin
2127+
CustomBusinessMonthEnd
2128+
CustomBusinessMonthBegin
2129+
SemiMonthOffset
2130+
SemiMonthEnd
2131+
SemiMonthBegin
2132+
Week
2133+
WeekOfMonth
2134+
LastWeekOfMonth
2135+
QuarterOffset
2136+
BQuarterEnd
2137+
BQuarterBegin
2138+
QuarterEnd
2139+
QuarterBegin
2140+
YearOffset
2141+
BYearEnd
2142+
BYearBegin
2143+
YearEnd
2144+
YearBegin
2145+
FY5253
2146+
FY5253Quarter
2147+
Easter
2148+
Tick
2149+
Day
2150+
Hour
2151+
Minute
2152+
Second
2153+
Milli
2154+
Micro
2155+
Nano
2156+
BDay
2157+
BMonthEnd
2158+
BMonthBegin
2159+
CBMonthEnd
2160+
CBMonthBegin
2161+
CDay
2162+
21082163
.. _api.frequencies:
21092164

21102165
Frequencies

doc/source/basics.rst

+15-2
Original file line numberDiff line numberDiff line change
@@ -1466,8 +1466,21 @@ for altering the ``Series.name`` attribute.
14661466
14671467
.. _basics.rename_axis:
14681468

1469-
The Panel class has a related :meth:`~Panel.rename_axis` class which can rename
1470-
any of its three axes.
1469+
.. versionadded:: 0.24.0
1470+
1471+
The methods :meth:`~DataFrame.rename_axis` and :meth:`~Series.rename_axis`
1472+
allow specific names of a `MultiIndex` to be changed (as opposed to the
1473+
labels).
1474+
1475+
.. ipython:: python
1476+
1477+
df = pd.DataFrame({'x': [1, 2, 3, 4, 5, 6],
1478+
'y': [10, 20, 30, 40, 50, 60]},
1479+
index=pd.MultiIndex.from_product([['a', 'b', 'c'], [1, 2]],
1480+
names=['let', 'num']))
1481+
df
1482+
df.rename_axis(index={'let': 'abc'})
1483+
df.rename_axis(index=str.upper)
14711484
14721485
.. _basics.iteration:
14731486

0 commit comments

Comments
 (0)