Skip to content

Commit 7cba5b1

Browse files
committed
Merge remote-tracking branch 'upstream/master' into holiday_update
2 parents cc0abbd + 6d35836 commit 7cba5b1

File tree

276 files changed

+10969
-7567
lines changed

Some content is hidden

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

276 files changed

+10969
-7567
lines changed

.travis.yml

+11-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ matrix:
3030
- python: 3.5
3131

3232
include:
33+
- dist: bionic
34+
# 18.04
35+
python: 3.8-dev
36+
env:
37+
- JOB="3.8-dev" PATTERN="(not slow and not network)"
38+
3339
- dist: trusty
3440
env:
3541
- JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="(not slow and not network)"
@@ -71,24 +77,27 @@ before_install:
7177
# This overrides travis and tells it to look nowhere.
7278
- export BOTO_CONFIG=/dev/null
7379

80+
7481
install:
7582
- echo "install start"
7683
- ci/prep_cython_cache.sh
7784
- ci/setup_env.sh
7885
- ci/submit_cython_cache.sh
7986
- echo "install done"
8087

88+
8189
before_script:
8290
# display server (for clipboard functionality) needs to be started here,
8391
# does not work if done in install:setup_env.sh (GH-26103)
8492
- export DISPLAY=":99.0"
8593
- echo "sh -e /etc/init.d/xvfb start"
86-
- sh -e /etc/init.d/xvfb start
94+
- if [ "$JOB" != "3.8-dev" ]; then sh -e /etc/init.d/xvfb start; fi
8795
- sleep 3
8896

8997
script:
9098
- echo "script start"
91-
- source activate pandas-dev
99+
- echo "$JOB"
100+
- if [ "$JOB" != "3.8-dev" ]; then source activate pandas-dev; fi
92101
- ci/run_tests.sh
93102

94103
after_script:

asv_bench/benchmarks/categoricals.py

+14
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,18 @@ def time_sort_values(self):
282282
self.index.sort_values(ascending=False)
283283

284284

285+
class SearchSorted:
286+
def setup(self):
287+
N = 10 ** 5
288+
self.ci = tm.makeCategoricalIndex(N).sort_values()
289+
self.c = self.ci.values
290+
self.key = self.ci.categories[1]
291+
292+
def time_categorical_index_contains(self):
293+
self.ci.searchsorted(self.key)
294+
295+
def time_categorical_contains(self):
296+
self.c.searchsorted(self.key)
297+
298+
285299
from .pandas_vb_common import setup # noqa: F401 isort:skip

asv_bench/benchmarks/ctors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class SeriesConstructors:
6767
def setup(self, data_fmt, with_index, dtype):
6868
if data_fmt in (gen_of_str, gen_of_tuples) and with_index:
6969
raise NotImplementedError(
70-
"Series constructors do not support " "using generators with indexes"
70+
"Series constructors do not support using generators with indexes"
7171
)
7272
N = 10 ** 4
7373
if dtype == "float":

asv_bench/benchmarks/eval.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def time_add(self, engine, threads):
2727

2828
def time_and(self, engine, threads):
2929
pd.eval(
30-
"(self.df > 0) & (self.df2 > 0) & " "(self.df3 > 0) & (self.df4 > 0)",
30+
"(self.df > 0) & (self.df2 > 0) & (self.df3 > 0) & (self.df4 > 0)",
3131
engine=engine,
3232
)
3333

asv_bench/benchmarks/io/hdf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ def time_write_store_table_dc(self):
8888

8989
def time_query_store_table_wide(self):
9090
self.store.select(
91-
"table_wide", where="index > self.start_wide and " "index < self.stop_wide"
91+
"table_wide", where="index > self.start_wide and index < self.stop_wide"
9292
)
9393

9494
def time_query_store_table(self):
95-
self.store.select("table", where="index > self.start and " "index < self.stop")
95+
self.store.select("table", where="index > self.start and index < self.stop")
9696

9797
def time_store_repr(self):
9898
repr(self.store)

ci/build38.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash -e
2+
# Special build for python3.8 until numpy puts its own wheels up
3+
4+
sudo apt-get install build-essential gcc xvfb
5+
pip install --no-deps -U pip wheel setuptools
6+
pip install python-dateutil pytz cython pytest pytest-xdist hypothesis
7+
8+
# Possible alternative for getting numpy:
9+
pip install --pre -f https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com/ numpy
10+
11+
python setup.py build_ext -inplace
12+
python -m pip install --no-build-isolation -e .
13+
14+
python -c "import sys; print(sys.version_info)"
15+
python -c "import pandas as pd"
16+
python -c "import hypothesis"
17+
18+
# TODO: Is there anything else in setup_env that we really want to do?
19+
# ci/setup_env.sh

ci/code_checks.sh

+12-4
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
122122
MSG='Check for non-standard imports' ; echo $MSG
123123
invgrep -R --include="*.py*" -E "from pandas.core.common import " pandas
124124
invgrep -R --include="*.py*" -E "from collections.abc import " pandas
125-
# invgrep -R --include="*.py*" -E "from numpy import nan " pandas # GH#24822 not yet implemented since the offending imports have not all been removed
125+
invgrep -R --include="*.py*" -E "from numpy import nan " pandas
126+
RET=$(($RET + $?)) ; echo $MSG "DONE"
127+
128+
MSG='Check for use of exec' ; echo $MSG
129+
invgrep -R --include="*.py*" -E "[^a-zA-Z0-9_]exec\(" pandas
126130
RET=$(($RET + $?)) ; echo $MSG "DONE"
127131

128132
MSG='Check for pytest warns' ; echo $MSG
@@ -184,7 +188,7 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
184188
invgrep -R --include="*.rst" ".. ipython ::" doc/source
185189
RET=$(($RET + $?)) ; echo $MSG "DONE"
186190

187-
MSG='Check that no file in the repo contains tailing whitespaces' ; echo $MSG
191+
MSG='Check that no file in the repo contains trailing whitespaces' ; echo $MSG
188192
set -o pipefail
189193
if [[ "$AZURE" == "true" ]]; then
190194
# we exclude all c/cpp files as the c/cpp files of pandas code base are tested when Linting .c and .h files
@@ -262,13 +266,17 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
262266
-k"-from_arrays -from_breaks -from_intervals -from_tuples -set_closed -to_tuples -interval_range"
263267
RET=$(($RET + $?)) ; echo $MSG "DONE"
264268

269+
MSG='Doctests arrays/string_.py' ; echo $MSG
270+
pytest -q --doctest-modules pandas/core/arrays/string_.py
271+
RET=$(($RET + $?)) ; echo $MSG "DONE"
272+
265273
fi
266274

267275
### DOCSTRINGS ###
268276
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
269277

270-
MSG='Validate docstrings (GL03, GL04, GL05, GL06, GL07, GL09, GL10, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT01, RT04, RT05, SA05)' ; echo $MSG
271-
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL03,GL04,GL05,GL06,GL07,GL09,GL10,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT01,RT04,RT05,SA05
278+
MSG='Validate docstrings (GL03, GL04, GL05, GL06, GL07, GL09, GL10, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT01, RT04, RT05, SA01, SA02, SA03, SA05)' ; echo $MSG
279+
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL03,GL04,GL05,GL06,GL07,GL09,GL10,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT01,RT04,RT05,SA01,SA02,SA03,SA05
272280
RET=$(($RET + $?)) ; echo $MSG "DONE"
273281

274282
fi

ci/deps/azure-36-32bit.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ channels:
33
- defaults
44
- conda-forge
55
dependencies:
6+
- attrs=19.1.0
67
- gcc_linux-32
78
- gcc_linux-32
89
- gxx_linux-32
@@ -11,7 +12,7 @@ dependencies:
1112
- python=3.6.*
1213
- pytz=2017.2
1314
# universal
14-
- pytest>=4.0.2,<5.0.0
15+
- pytest
1516
- pytest-xdist
1617
- pytest-mock
1718
- pytest-azurepipelines

ci/run_tests.sh

+5-6
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ do
4343
# if no tests are found (the case of "single and slow"), pytest exits with code 5, and would make the script fail, if not for the below code
4444
sh -c "$PYTEST_CMD; ret=\$?; [ \$ret = 5 ] && exit 0 || exit \$ret"
4545

46-
# 2019-08-21 disabling because this is hitting HTTP 400 errors GH#27602
47-
# if [[ "$COVERAGE" && $? == 0 && "$TRAVIS_BRANCH" == "master" ]]; then
48-
# echo "uploading coverage for $TYPE tests"
49-
# echo "bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME"
50-
# bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME
51-
# fi
46+
if [[ "$COVERAGE" && $? == 0 && "$TRAVIS_BRANCH" == "master" ]]; then
47+
echo "uploading coverage for $TYPE tests"
48+
echo "bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME"
49+
bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME
50+
fi
5251
done

ci/setup_env.sh

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

3+
if [ "$JOB" == "3.8-dev" ]; then
4+
/bin/bash ci/build38.sh
5+
exit 0
6+
fi
37

48
# edit the locale file if needed
59
if [ -n "$LOCALE_OVERRIDE" ]; then
@@ -51,6 +55,7 @@ echo
5155
echo "update conda"
5256
conda config --set ssl_verify false
5357
conda config --set quiet true --set always_yes true --set changeps1 false
58+
conda install pip # create conda to create a historical artifact for pip & setuptools
5459
conda update -n base conda
5560

5661
echo "conda info -a"

doc/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
data/
2+
timeseries.csv
3+
timeseries.parquet
4+
timeseries_wide.parquet

doc/redirects.csv

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ whatsnew,whatsnew/index
66
release,whatsnew/index
77

88
# getting started
9+
install,getting_started/install
910
10min,getting_started/10min
1011
basics,getting_started/basics
1112
comparison_with_r,getting_started/comparison/comparison_with_r
@@ -1577,3 +1578,6 @@ generated/pandas.unique,../reference/api/pandas.unique
15771578
generated/pandas.util.hash_array,../reference/api/pandas.util.hash_array
15781579
generated/pandas.util.hash_pandas_object,../reference/api/pandas.util.hash_pandas_object
15791580
generated/pandas.wide_to_long,../reference/api/pandas.wide_to_long
1581+
1582+
# Cached searches
1583+
reference/api/pandas.DataFrame.from_csv,pandas.read_csv

doc/source/conf.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@
120120
plot_pre_code = """import numpy as np
121121
import pandas as pd"""
122122

123+
# nbsphinx do not use requirejs (breaks bootstrap)
124+
nbsphinx_requirejs_path = ""
125+
123126
# Add any paths that contain templates here, relative to this directory.
124127
templates_path = ["../_templates"]
125128

@@ -191,7 +194,7 @@
191194

192195
# The theme to use for HTML and HTML Help pages. Major themes that come with
193196
# Sphinx are currently 'default' and 'sphinxdoc'.
194-
html_theme = "nature_with_gtoc"
197+
html_theme = "pandas_sphinx_theme"
195198

196199
# The style sheet to use for HTML and HTML Help pages. A file of that name
197200
# must exist either in Sphinx' static/ path, or in one of the custom paths
@@ -204,7 +207,7 @@
204207
# html_theme_options = {}
205208

206209
# Add any paths that contain custom themes here, relative to this directory.
207-
html_theme_path = ["themes"]
210+
# html_theme_path = ["themes"]
208211

209212
# The name for this set of Sphinx documents. If None, it defaults to
210213
# "<project> v<release> documentation".
@@ -628,11 +631,11 @@ def linkcode_resolve(domain, info):
628631
fn = os.path.relpath(fn, start=os.path.dirname(pandas.__file__))
629632

630633
if "+" in pandas.__version__:
631-
return "http://github.com/pandas-dev/pandas/blob/master/pandas/" "{}{}".format(
634+
return "http://github.com/pandas-dev/pandas/blob/master/pandas/{}{}".format(
632635
fn, linespec
633636
)
634637
else:
635-
return "http://github.com/pandas-dev/pandas/blob/" "v{}/pandas/{}{}".format(
638+
return "http://github.com/pandas-dev/pandas/blob/v{}/pandas/{}{}".format(
636639
pandas.__version__, fn, linespec
637640
)
638641

doc/source/development/contributing.rst

+5-2
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ installed (or you wish to install a newer version) you can install a compiler
172172
yum groupinstall "Development Tools"
173173

174174
For other Linux distributions, consult your favourite search engine for
175-
commpiler installation instructions.
175+
compiler installation instructions.
176176

177177
Let us know if you have any difficulties by opening an issue or reaching out on
178178
`Gitter`_.
@@ -949,10 +949,13 @@ the expected correct result::
949949

950950
assert_frame_equal(pivoted, expected)
951951

952+
Please remember to add the Github Issue Number as a comment to a new test.
953+
E.g. "# brief comment, see GH#28907"
954+
952955
Transitioning to ``pytest``
953956
~~~~~~~~~~~~~~~~~~~~~~~~~~~
954957

955-
*pandas* existing test structure is *mostly* classed based, meaning that you will typically find tests wrapped in a class.
958+
*pandas* existing test structure is *mostly* class-based, meaning that you will typically find tests wrapped in a class.
956959

957960
.. code-block:: python
958961

doc/source/ecosystem.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
:orphan:
2+
13
.. _ecosystem:
24

35
{{ header }}

doc/source/getting_started/basics.rst

+16-3
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ not noted for a particular column will be ``NaN``:
986986
987987
tsdf.agg({'A': ['mean', 'min'], 'B': 'sum'})
988988
989-
.. _basics.aggregation.mixed_dtypes:
989+
.. _basics.aggregation.mixed_string:
990990

991991
Mixed dtypes
992992
++++++++++++
@@ -1704,14 +1704,21 @@ built-in string methods. For example:
17041704

17051705
.. ipython:: python
17061706
1707-
s = pd.Series(['A', 'B', 'C', 'Aaba', 'Baca', np.nan, 'CABA', 'dog', 'cat'])
1707+
s = pd.Series(['A', 'B', 'C', 'Aaba', 'Baca', np.nan, 'CABA', 'dog', 'cat'],
1708+
dtype="string")
17081709
s.str.lower()
17091710
17101711
Powerful pattern-matching methods are provided as well, but note that
17111712
pattern-matching generally uses `regular expressions
17121713
<https://docs.python.org/3/library/re.html>`__ by default (and in some cases
17131714
always uses them).
17141715

1716+
.. note::
1717+
1718+
Prior to pandas 1.0, string methods were only available on ``object`` -dtype
1719+
``Series``. Pandas 1.0 added the :class:`StringDtype` which is dedicated
1720+
to strings. See :ref:`text.types` for more.
1721+
17151722
Please see :ref:`Vectorized String Methods <text.string_methods>` for a complete
17161723
description.
17171724

@@ -1925,9 +1932,15 @@ period (time spans) :class:`PeriodDtype` :class:`Period` :class:`arrays.
19251932
sparse :class:`SparseDtype` (none) :class:`arrays.SparseArray` :ref:`sparse`
19261933
intervals :class:`IntervalDtype` :class:`Interval` :class:`arrays.IntervalArray` :ref:`advanced.intervalindex`
19271934
nullable integer :class:`Int64Dtype`, ... (none) :class:`arrays.IntegerArray` :ref:`integer_na`
1935+
Strings :class:`StringDtype` :class:`str` :class:`arrays.StringArray` :ref:`text`
19281936
=================== ========================= ================== ============================= =============================
19291937

1930-
Pandas uses the ``object`` dtype for storing strings.
1938+
Pandas has two ways to store strings.
1939+
1940+
1. ``object`` dtype, which can hold any Python object, including strings.
1941+
2. :class:`StringDtype`, which is dedicated to strings.
1942+
1943+
Generally, we recommend using :class:`StringDtype`. See :ref:`text.types` fore more.
19311944

19321945
Finally, arbitrary objects may be stored using the ``object`` dtype, but should
19331946
be avoided to the extent possible (for performance and interoperability with

doc/source/getting_started/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Getting started
1212
.. toctree::
1313
:maxdepth: 2
1414

15+
install
1516
overview
1617
10min
1718
basics

doc/source/install.rst renamed to doc/source/getting_started/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Instructions for installing from source,
1818
Python version support
1919
----------------------
2020

21-
Officially Python 3.5.3 and above, 3.6, and 3.7.
21+
Officially Python 3.5.3 and above, 3.6, 3.7, and 3.8.
2222

2323
Installing pandas
2424
-----------------

doc/source/index.rst.template

+2-3
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ See the :ref:`overview` for more detail about what's in the library.
4040
{% endif %}
4141
{% if not single_doc %}
4242
What's New in 1.0.0 <whatsnew/v1.0.0>
43-
install
4443
getting_started/index
4544
user_guide/index
46-
ecosystem
4745
{% endif -%}
4846
{% if include_api -%}
4947
reference/index
@@ -54,9 +52,9 @@ See the :ref:`overview` for more detail about what's in the library.
5452
{% endif %}
5553

5654
* :doc:`whatsnew/v1.0.0`
57-
* :doc:`install`
5855
* :doc:`getting_started/index`
5956

57+
* :doc:`getting_started/install`
6058
* :doc:`getting_started/overview`
6159
* :doc:`getting_started/10min`
6260
* :doc:`getting_started/basics`
@@ -83,6 +81,7 @@ See the :ref:`overview` for more detail about what's in the library.
8381
* :doc:`user_guide/style`
8482
* :doc:`user_guide/options`
8583
* :doc:`user_guide/enhancingperf`
84+
* :doc:`user_guide/scale`
8685
* :doc:`user_guide/sparse`
8786
* :doc:`user_guide/gotchas`
8887
* :doc:`user_guide/cookbook`

0 commit comments

Comments
 (0)