Skip to content

Commit 8d7399f

Browse files
committed
Merge remote-tracking branch 'upstream/master' into docfix-multiindex-set_levels
1 parent a76adb3 commit 8d7399f

File tree

267 files changed

+14706
-95796
lines changed

Some content is hidden

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

267 files changed

+14706
-95796
lines changed

.binstar.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package: pandas
2+
user: jreback
3+
4+
install:
5+
- conda config --add channels pandas
6+
7+
before_script:
8+
- python -V
9+
10+
platform:
11+
- linux-64
12+
#- linux-32
13+
- osx-64
14+
#- win-32
15+
- win-64
16+
engine:
17+
- python=2.7
18+
- python=3.4
19+
script:
20+
- conda build conda.recipe --quiet
21+
22+
iotimeout: 600
23+
24+
build_targets: conda
25+
26+
notifications:
27+
email:
28+
recipients: ['[email protected]']

.travis.yml

+5
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,17 @@ matrix:
4848
- mysql
4949
- postgresql
5050

51+
# In allow_failures
5152
- env:
5253
- JOB="3.6, slow" ENV_FILE="ci/deps/travis-36-slow.yaml" PATTERN="slow" SQL="1"
5354
services:
5455
- mysql
5556
- postgresql
5657

58+
allow_failures:
59+
- env:
60+
- JOB="3.6, slow" ENV_FILE="ci/deps/travis-36-slow.yaml" PATTERN="slow" SQL="1"
61+
5762
before_install:
5863
- echo "before_install"
5964
# set non-blocking IO on travis

LICENSES/MSGPACK_LICENSE

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright (C) 2008-2011 INADA Naoki <[email protected]>
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

LICENSES/MSGPACK_NUMPY_LICENSE

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.. -*- rst -*-
2+
3+
License
4+
=======
5+
6+
Copyright (c) 2013, Lev Givon.
7+
All rights reserved.
8+
9+
Redistribution and use in source and binary forms, with or without
10+
modification, are permitted provided that the following conditions are
11+
met:
12+
13+
* Redistributions of source code must retain the above copyright
14+
notice, this list of conditions and the following disclaimer.
15+
* Redistributions in binary form must reproduce the above
16+
copyright notice, this list of conditions and the following
17+
disclaimer in the documentation and/or other materials provided
18+
with the distribution.
19+
* Neither the name of Lev Givon nor the names of any
20+
contributors may be used to endorse or promote products derived
21+
from this software without specific prior written permission.
22+
23+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

asv_bench/benchmarks/io/msgpack.py

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import warnings
2+
3+
import numpy as np
4+
5+
from pandas import DataFrame, date_range, read_msgpack
6+
import pandas.util.testing as tm
7+
8+
from ..pandas_vb_common import BaseIO
9+
10+
11+
class MSGPack(BaseIO):
12+
def setup(self):
13+
self.fname = "__test__.msg"
14+
N = 100000
15+
C = 5
16+
self.df = DataFrame(
17+
np.random.randn(N, C),
18+
columns=[f"float{i}" for i in range(C)],
19+
index=date_range("20000101", periods=N, freq="H"),
20+
)
21+
self.df["object"] = tm.makeStringIndex(N)
22+
with warnings.catch_warnings(record=True):
23+
self.df.to_msgpack(self.fname)
24+
25+
def time_read_msgpack(self):
26+
read_msgpack(self.fname)
27+
28+
def time_write_msgpack(self):
29+
self.df.to_msgpack(self.fname)
30+
31+
32+
from ..pandas_vb_common import setup # noqa: F401 isort:skip

ci/azure/posix.yml

+7-21
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,18 @@ jobs:
1919
ENV_FILE: ci/deps/azure-36-minimum_versions.yaml
2020
CONDA_PY: "36"
2121
PATTERN: "not slow and not network"
22-
2322
py36_locale_slow_old_np:
2423
ENV_FILE: ci/deps/azure-36-locale_slow.yaml
2524
CONDA_PY: "36"
2625
PATTERN: "slow"
27-
# pandas does not use the language (zh_CN), but should support diferent encodings (utf8)
28-
# we should test with encodings different than utf8, but doesn't seem like Ubuntu supports any
29-
LANG: "zh_CN.utf8"
30-
LC_ALL: "zh_CN.utf8"
26+
LOCALE_OVERRIDE: "zh_CN.UTF-8"
3127
EXTRA_APT: "language-pack-zh-hans"
3228

3329
py36_locale:
3430
ENV_FILE: ci/deps/azure-36-locale.yaml
3531
CONDA_PY: "36"
3632
PATTERN: "not slow and not network"
37-
LANG: "it_IT.utf8"
38-
LC_ALL: "it_IT.utf8"
39-
EXTRA_APT: "language-pack-it"
33+
LOCALE_OVERRIDE: "it_IT.UTF-8"
4034

4135
py36_32bit:
4236
ENV_FILE: ci/deps/azure-36-32bit.yaml
@@ -48,9 +42,7 @@ jobs:
4842
ENV_FILE: ci/deps/azure-37-locale.yaml
4943
CONDA_PY: "37"
5044
PATTERN: "not slow and not network"
51-
LANG: "zh_CN.utf8"
52-
LC_ALL: "zh_CN.utf8"
53-
EXTRA_APT: "language-pack-zh-hans"
45+
LOCALE_OVERRIDE: "zh_CN.UTF-8"
5446

5547
py37_np_dev:
5648
ENV_FILE: ci/deps/azure-37-numpydev.yaml
@@ -62,16 +54,10 @@ jobs:
6254

6355
steps:
6456
- script: |
65-
if [ "$(uname)" == "Linux" ]; then
66-
sudo apt-get update
67-
sudo apt-get install -y libc6-dev-i386 $EXTRA_APT
68-
fi
69-
displayName: 'Install extra packages'
70-
71-
- script: echo '##vso[task.prependpath]$(HOME)/miniconda3/bin'
72-
displayName: 'Set conda path'
73-
74-
- script: ci/setup_env.sh
57+
if [ "$(uname)" == "Linux" ]; then sudo apt-get install -y libc6-dev-i386 $EXTRA_APT; fi
58+
echo '##vso[task.prependpath]$(HOME)/miniconda3/bin'
59+
echo "Creating Environment"
60+
ci/setup_env.sh
7561
displayName: 'Setup environment and build pandas'
7662
7763
- script: |

ci/azure/windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- bash: |
3535
source activate pandas-dev
3636
conda list
37-
python setup.py build_ext -q -i -j 4
37+
python setup.py build_ext -q -i
3838
python -m pip install --no-build-isolation -e .
3939
displayName: 'Build'
4040

ci/deps/azure-36-locale_slow.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dependencies:
1313
- pytest-azurepipelines
1414

1515
# pandas dependencies
16-
- beautifulsoup4=4.6.0
16+
- beautifulsoup4==4.6.0
1717
- bottleneck=1.2.*
1818
- lxml
1919
- matplotlib=2.2.2

ci/incremental/build.cmd

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@rem https://github.com/numba/numba/blob/master/buildscripts/incremental/build.cmd
2+
3+
@rem Build extensions
4+
python setup.py build_ext -q -i
5+
6+
@rem Install pandas
7+
python -m pip install --no-build-isolation -e .
8+
9+
if %errorlevel% neq 0 exit /b %errorlevel%

ci/run_tests.sh

+11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55
# https://github.com/pytest-dev/pytest/issues/1075
66
export PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 4294967295))')
77

8+
if [ -n "$LOCALE_OVERRIDE" ]; then
9+
export LC_ALL="$LOCALE_OVERRIDE"
10+
export LANG="$LOCALE_OVERRIDE"
11+
PANDAS_LOCALE=`python -c 'import pandas; pandas.get_option("display.encoding")'`
12+
if [[ "$LOCALE_OVERRIDE" != "$PANDAS_LOCALE" ]]; then
13+
echo "pandas could not detect the locale. System locale: $LOCALE_OVERRIDE, pandas detected: $PANDAS_LOCALE"
14+
# TODO Not really aborting the tests until https://github.com/pandas-dev/pandas/issues/23923 is fixed
15+
# exit 1
16+
fi
17+
fi
18+
819
if [[ "not network" == *"$PATTERN"* ]]; then
920
export http_proxy=http://1.2.3.4 https_proxy=http://1.2.3.4;
1021
fi

ci/setup_env.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#!/bin/bash -e
22

33
# edit the locale file if needed
4-
if [[ "$(uname)" == "Linux" && -n "$LC_ALL" ]]; then
4+
if [ -n "$LOCALE_OVERRIDE" ]; then
55
echo "Adding locale to the first line of pandas/__init__.py"
66
rm -f pandas/__init__.pyc
7-
SEDC="3iimport locale\nlocale.setlocale(locale.LC_ALL, '$LC_ALL')\n"
7+
SEDC="3iimport locale\nlocale.setlocale(locale.LC_ALL, '$LOCALE_OVERRIDE')\n"
88
sed -i "$SEDC" pandas/__init__.py
9-
109
echo "[head -4 pandas/__init__.py]"
1110
head -4 pandas/__init__.py
1211
echo
12+
sudo locale-gen "$LOCALE_OVERRIDE"
1313
fi
1414

1515
MINICONDA_DIR="$HOME/miniconda3"

doc/source/getting_started/10min.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,8 @@ Plotting
697697

698698
See the :ref:`Plotting <visualization>` docs.
699699

700-
We use the standard convention for referencing the matplotlib API:
701-
702700
.. ipython:: python
701+
:suppress:
703702
704703
import matplotlib.pyplot as plt
705704
plt.close('all')

doc/source/whatsnew/v1.0.0.rst

+4-10
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Dedicated string data type
5656
^^^^^^^^^^^^^^^^^^^^^^^^^^
5757

5858
We've added :class:`StringDtype`, an extension type dedicated to string data.
59-
Previously, strings were typically stored in object-dtype NumPy arrays. (:issue:`29975`)
59+
Previously, strings were typically stored in object-dtype NumPy arrays.
6060

6161
.. warning::
6262

@@ -213,8 +213,8 @@ Other enhancements
213213
- DataFrame constructor preserve `ExtensionArray` dtype with `ExtensionArray` (:issue:`11363`)
214214
- :meth:`DataFrame.sort_values` and :meth:`Series.sort_values` have gained ``ignore_index`` keyword to be able to reset index after sorting (:issue:`30114`)
215215
- :meth:`DataFrame.to_markdown` and :meth:`Series.to_markdown` added (:issue:`11052`)
216+
216217
- :meth:`DataFrame.drop_duplicates` has gained ``ignore_index`` keyword to reset index (:issue:`30114`)
217-
- Added new writer for exporting Stata dta files in version 118, ``StataWriter118``. This format supports exporting strings containing Unicode characters (:issue:`23573`)
218218

219219
Build Changes
220220
^^^^^^^^^^^^^
@@ -773,7 +773,6 @@ Datetimelike
773773
- Bug in :class:`Timestamp` subtraction when subtracting a :class:`Timestamp` from a ``np.datetime64`` object incorrectly raising ``TypeError`` (:issue:`28286`)
774774
- Addition and subtraction of integer or integer-dtype arrays with :class:`Timestamp` will now raise ``NullFrequencyError`` instead of ``ValueError`` (:issue:`28268`)
775775
- Bug in :class:`Series` and :class:`DataFrame` with integer dtype failing to raise ``TypeError`` when adding or subtracting a ``np.datetime64`` object (:issue:`28080`)
776-
- Bug in :meth:`Series.astype`, :meth:`Index.astype`, and :meth:`DataFrame.astype` failing to handle ``NaT`` when casting to an integer dtype (:issue:`28492`)
777776
- Bug in :class:`Week` with ``weekday`` incorrectly raising ``AttributeError`` instead of ``TypeError`` when adding or subtracting an invalid type (:issue:`28530`)
778777
- Bug in :class:`DataFrame` arithmetic operations when operating with a :class:`Series` with dtype `'timedelta64[ns]'` (:issue:`28049`)
779778
- Bug in :func:`pandas.core.groupby.generic.SeriesGroupBy.apply` raising ``ValueError`` when a column in the original DataFrame is a datetime and the column labels are not standard integers (:issue:`28247`)
@@ -886,7 +885,6 @@ I/O
886885
- Bug in :func:`read_json` where default encoding was not set to ``utf-8`` (:issue:`29565`)
887886
- Bug in :class:`PythonParser` where str and bytes were being mixed when dealing with the decimal field (:issue:`29650`)
888887
- :meth:`read_gbq` now accepts ``progress_bar_type`` to display progress bar while the data downloads. (:issue:`29857`)
889-
- Bug in :func:`pandas.io.json.json_normalize` where a missing value in the location specified by `record_path` would raise a ``TypeError`` (:issue:`30148`)
890888

891889
Plotting
892890
^^^^^^^^
@@ -902,13 +900,12 @@ Plotting
902900
- :func:`set_option` now validates that the plot backend provided to ``'plotting.backend'`` implements the backend when the option is set, rather than when a plot is created (:issue:`28163`)
903901
- :meth:`DataFrame.plot` now allow a ``backend`` keyword argument to allow changing between backends in one session (:issue:`28619`).
904902
- Bug in color validation incorrectly raising for non-color styles (:issue:`29122`).
905-
- Allow :meth: `DataFrame.plot.scatter` to plot ``objects`` and ``datetime`` type data (:issue:`18755`, :issue:`30391`)
906903
- Bug in :meth:`DataFrame.hist`, ``xrot=0`` does not work with ``by`` and subplots (:issue:`30288`).
907904

908905
Groupby/resample/rolling
909906
^^^^^^^^^^^^^^^^^^^^^^^^
910907

911-
- Bug in :meth:`DataFrame.groupby.apply` only showing output from a single group when function returns an :class:`Index` (:issue:`28652`)
908+
-
912909
- Bug in :meth:`DataFrame.groupby` with multiple groups where an ``IndexError`` would be raised if any group contained all NA values (:issue:`20519`)
913910
- Bug in :meth:`pandas.core.resample.Resampler.size` and :meth:`pandas.core.resample.Resampler.count` returning wrong dtype when used with an empty series or dataframe (:issue:`28427`)
914911
- Bug in :meth:`DataFrame.rolling` not allowing for rolling over datetimes when ``axis=1`` (:issue:`28192`)
@@ -938,7 +935,6 @@ Reshaping
938935
- :func:`qcut` and :func:`cut` now handle boolean input (:issue:`20303`)
939936
- Fix to ensure all int dtypes can be used in :func:`merge_asof` when using a tolerance value. Previously every non-int64 type would raise an erroneous ``MergeError`` (:issue:`28870`).
940937
- Better error message in :func:`get_dummies` when `columns` isn't a list-like value (:issue:`28383`)
941-
- Bug in :meth:`Index.join` that caused infinite recursion error for mismatched ``MultiIndex`` name orders. (:issue:`25760`, :issue:`28956`)
942938
- Bug :meth:`Series.pct_change` where supplying an anchored frequency would throw a ValueError (:issue:`28664`)
943939
- Bug where :meth:`DataFrame.equals` returned True incorrectly in some cases when two DataFrames had the same columns in different orders (:issue:`28839`)
944940
- Bug in :meth:`DataFrame.replace` that caused non-numeric replacer's dtype not respected (:issue:`26632`)
@@ -976,9 +972,7 @@ Other
976972
- Fixed :class:`IntegerArray` returning ``inf`` rather than ``NaN`` for operations dividing by 0 (:issue:`27398`)
977973
- Fixed ``pow`` operations for :class:`IntegerArray` when the other value is ``0`` or ``1`` (:issue:`29997`)
978974
- Bug in :meth:`Series.count` raises if use_inf_as_na is enabled (:issue:`29478`)
979-
- Bug in :class:`Index` where a non-hashable name could be set without raising ``TypeError`` (:issue:`29069`)
980-
- Bug in :class:`DataFrame` constructor when passing a 2D ``ndarray`` and an extension dtype (:issue:`12513`)
981-
- Bug in :meth:`DaataFrame.to_csv` when supplied a series with a ``dtype="string"`` and a ``na_rep``, the ``na_rep`` was being truncated to 2 characters. (:issue:`29975`)
975+
- Bug in :class:`Index` where a non-hashable name could be set without raising ``TypeError`` (:issue:29069`)
982976

983977
.. _whatsnew_1000.contributors:
984978

0 commit comments

Comments
 (0)