Skip to content

Commit aaa21bb

Browse files
committed
Merge remote-tracking branch 'upstream/master' into pivot
* upstream/master: (110 commits) DOC: hardcode contributors for 0.24.x releases (pandas-dev#25662) DOC: restore toctree maxdepth (pandas-dev#25134) BUG: Redefine IndexOpsMixin.size, fix pandas-dev#25580. (pandas-dev#25584) BUG: to_csv line endings with compression (pandas-dev#25625) DOC: file obj for to_csv must be newline='' (pandas-dev#25624) Suppress incorrect warning in nargsort for timezone-aware DatetimeIndex (pandas-dev#25629) TST: fix incorrect sparse test (now failing on scipy master) (pandas-dev#25653) CLN: Removed debugging code (pandas-dev#25647) DOC: require Return section only if return is not None nor commentary (pandas-dev#25008) DOC:Remove hard-coded examples from _flex_doc_SERIES (pandas-dev#24589) (pandas-dev#25524) TST: xref pandas-dev#25630 (pandas-dev#25643) BUG: Fix pandas-dev#25481 by fixing the error message in TypeError (pandas-dev#25540) Fixturize tests/frame/test_mutate_columns.py (pandas-dev#25642) Fixturize tests/frame/test_join.py (pandas-dev#25639) Fixturize tests/frame/test_combine_concat.py (pandas-dev#25634) Fixturize tests/frame/test_asof.py (pandas-dev#25628) BUG: Fix user-facing AssertionError with to_html (pandas-dev#25608) (pandas-dev#25620) DOC: resolve all GL03 docstring validation errors (pandas-dev#25525) TST: failing wheel building on PY2 and old numpy (pandas-dev#25631) DOC: Remove makePanel from docs (pandas-dev#25609) (pandas-dev#25612) ...
2 parents 2108301 + feeba90 commit aaa21bb

File tree

226 files changed

+4918
-3233
lines changed

Some content is hidden

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

226 files changed

+4918
-3233
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
<td>Package Status</td>
2727
<td>
2828
<a href="https://pypi.org/project/pandas/">
29-
<img src="https://img.shields.io/pypi/status/pandas.svg" alt="status" /></td>
29+
<img src="https://img.shields.io/pypi/status/pandas.svg" alt="status" />
3030
</a>
31+
</td>
3132
</tr>
3233
<tr>
3334
<td>License</td>
@@ -73,8 +74,8 @@
7374
<td>Gitter</td>
7475
<td>
7576
<a href="https://gitter.im/pydata/pandas">
76-
<img src="https://badges.gitter.im/Join%20Chat.svg"
77-
</a>
77+
<img src="https://badges.gitter.im/Join%20Chat.svg" />
78+
</a>
7879
</td>
7980
</tr>
8081
</table>

asv_bench/benchmarks/groupby.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
method_blacklist = {
1515
'object': {'median', 'prod', 'sem', 'cumsum', 'sum', 'cummin', 'mean',
1616
'max', 'skew', 'cumprod', 'cummax', 'rank', 'pct_change', 'min',
17-
'var', 'mad', 'describe', 'std'},
17+
'var', 'mad', 'describe', 'std', 'quantile'},
1818
'datetime': {'median', 'prod', 'sem', 'cumsum', 'sum', 'mean', 'skew',
1919
'cumprod', 'cummax', 'pct_change', 'var', 'mad', 'describe',
2020
'std'}
@@ -316,8 +316,9 @@ class GroupByMethods(object):
316316
['all', 'any', 'bfill', 'count', 'cumcount', 'cummax', 'cummin',
317317
'cumprod', 'cumsum', 'describe', 'ffill', 'first', 'head',
318318
'last', 'mad', 'max', 'min', 'median', 'mean', 'nunique',
319-
'pct_change', 'prod', 'rank', 'sem', 'shift', 'size', 'skew',
320-
'std', 'sum', 'tail', 'unique', 'value_counts', 'var'],
319+
'pct_change', 'prod', 'quantile', 'rank', 'sem', 'shift',
320+
'size', 'skew', 'std', 'sum', 'tail', 'unique', 'value_counts',
321+
'var'],
321322
['direct', 'transformation']]
322323

323324
def setup(self, dtype, method, application):

asv_bench/benchmarks/series_methods.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,25 @@ def time_dropna(self, dtype):
124124
self.s.dropna()
125125

126126

127+
class SearchSorted(object):
128+
129+
goal_time = 0.2
130+
params = ['int8', 'int16', 'int32', 'int64',
131+
'uint8', 'uint16', 'uint32', 'uint64',
132+
'float16', 'float32', 'float64',
133+
'str']
134+
param_names = ['dtype']
135+
136+
def setup(self, dtype):
137+
N = 10**5
138+
data = np.array([1] * N + [2] * N + [3] * N).astype(dtype)
139+
self.s = Series(data)
140+
141+
def time_searchsorted(self, dtype):
142+
key = '2' if dtype == 'str' else 2
143+
self.s.searchsorted(key)
144+
145+
127146
class Map(object):
128147

129148
params = ['dict', 'Series']

ci/code_checks.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ fi
241241
### DOCSTRINGS ###
242242
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
243243

244-
MSG='Validate docstrings (GL06, GL07, GL09, SS04, PR03, PR05, PR10, EX04, RT04, RT05, SS05, SA05)' ; echo $MSG
245-
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL06,GL07,GL09,SS04,PR03,PR04,PR05,EX04,RT04,RT05,SS05,SA05
244+
MSG='Validate docstrings (GL03, GL06, GL07, GL09, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT04, RT05, SA05)' ; echo $MSG
245+
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL03,GL06,GL07,GL09,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT04,RT05,SA05
246246
RET=$(($RET + $?)) ; echo $MSG "DONE"
247247

248248
fi

ci/deps/azure-27-compat.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ dependencies:
1818
- xlsxwriter=0.5.2
1919
- xlwt=0.7.5
2020
# universal
21-
- pytest
21+
- pytest>=4.0.2
2222
- pytest-xdist
2323
- pytest-mock
24+
- isort
2425
- pip:
2526
- html5lib==1.0b2
2627
- beautifulsoup4==4.2.1

ci/deps/azure-27-locale.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ dependencies:
2020
- xlsxwriter=0.5.2
2121
- xlwt=0.7.5
2222
# universal
23-
- pytest
23+
- pytest>=4.0.2
2424
- pytest-xdist
2525
- pytest-mock
2626
- hypothesis>=3.58.0
27+
- isort
2728
- pip:
2829
- html5lib==1.0b2
2930
- beautifulsoup4==4.2.1

ci/deps/azure-36-locale_slow.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ dependencies:
2626
- xlsxwriter
2727
- xlwt
2828
# universal
29-
- pytest
29+
- pytest>=4.0.2
3030
- pytest-xdist
3131
- pytest-mock
3232
- moto
33+
- isort
3334
- pip:
3435
- hypothesis>=3.58.0

ci/deps/azure-37-locale.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ dependencies:
2525
- xlsxwriter
2626
- xlwt
2727
# universal
28-
- pytest
28+
- pytest>=4.0.2
2929
- pytest-xdist
3030
- pytest-mock
31+
- isort
3132
- pip:
3233
- hypothesis>=3.58.0
3334
- moto # latest moto in conda-forge fails with 3.7, move to conda dependencies when this is fixed

ci/deps/azure-37-numpydev.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ dependencies:
66
- pytz
77
- Cython>=0.28.2
88
# universal
9-
- pytest
9+
- pytest>=4.0.2
1010
- pytest-xdist
1111
- pytest-mock
1212
- hypothesis>=3.58.0
13+
- isort
1314
- pip:
1415
- "git+git://github.com/dateutil/dateutil.git"
1516
- "-f https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com"

ci/deps/azure-macos-35.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ dependencies:
2121
- xlrd
2222
- xlsxwriter
2323
- xlwt
24-
# universal
25-
- pytest
26-
- pytest-xdist
27-
- pytest-mock
24+
- isort
2825
- pip:
2926
- python-dateutil==2.5.3
27+
# universal
28+
- pytest>=4.0.2
29+
- pytest-xdist
30+
- pytest-mock
3031
- hypothesis>=3.58.0

ci/deps/azure-windows-27.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ dependencies:
2525
- xlwt
2626
# universal
2727
- cython>=0.28.2
28-
- pytest
28+
- pytest>=4.0.2
2929
- pytest-xdist
3030
- pytest-mock
3131
- moto
3232
- hypothesis>=3.58.0
33+
- isort

ci/deps/azure-windows-36.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ dependencies:
2323
- xlwt
2424
# universal
2525
- cython>=0.28.2
26-
- pytest
26+
- pytest>=4.0.2
2727
- pytest-xdist
2828
- pytest-mock
2929
- hypothesis>=3.58.0
30+
- isort

ci/deps/travis-27.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ dependencies:
3939
- xlsxwriter=0.5.2
4040
- xlwt=0.7.5
4141
# universal
42-
- pytest
42+
- pytest>=4.0.2
4343
- pytest-xdist
4444
- pytest-mock
4545
- moto==1.3.4
4646
- hypothesis>=3.58.0
47+
- isort
4748
- pip:
4849
- backports.lzma
4950
- pandas-gbq

ci/deps/travis-36-doc.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@ dependencies:
4141
- xlsxwriter
4242
- xlwt
4343
# universal
44-
- pytest
44+
- pytest>=4.0.2
4545
- pytest-xdist
46+
- isort

ci/deps/travis-36-locale.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ dependencies:
2828
- xlsxwriter
2929
- xlwt
3030
# universal
31-
- pytest
31+
- pytest>=4.0.2
3232
- pytest-xdist
3333
- pytest-mock
3434
- moto
35+
- isort
3536
- pip:
3637
- hypothesis>=3.58.0

ci/deps/travis-36-slow.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ dependencies:
2525
- xlsxwriter
2626
- xlwt
2727
# universal
28-
- pytest
28+
- pytest>=4.0.2
2929
- pytest-xdist
3030
- pytest-mock
3131
- moto
3232
- hypothesis>=3.58.0
33+
- isort

ci/deps/travis-36.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ dependencies:
3333
- xlsxwriter
3434
- xlwt
3535
# universal
36-
- pytest
36+
- pytest>=4.0.2
3737
- pytest-xdist
3838
- pytest-cov
3939
- pytest-mock
4040
- hypothesis>=3.58.0
41+
- isort
4142
- pip:
4243
- brotlipy
4344
- coverage

ci/deps/travis-37.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ dependencies:
1212
- nomkl
1313
- pyarrow
1414
- pytz
15-
- pytest
15+
- pytest>=4.0.2
1616
- pytest-xdist
1717
- pytest-mock
1818
- hypothesis>=3.58.0
1919
- s3fs
20+
- isort
2021
- pip:
2122
- moto

doc/make.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,14 +294,16 @@ def main():
294294
help='number of jobs used by sphinx-build')
295295
argparser.add_argument('--no-api',
296296
default=False,
297-
help='ommit api and autosummary',
297+
help='omit api and autosummary',
298298
action='store_true')
299299
argparser.add_argument('--single',
300300
metavar='FILENAME',
301301
type=str,
302302
default=None,
303-
help=('filename of section or method name to '
304-
'compile, e.g. "indexing", "DataFrame.join"'))
303+
help=('filename (relative to the "source" folder)'
304+
' of section or method name to compile, e.g. '
305+
'"development/contributing.rst",'
306+
' "ecosystem.rst", "pandas.DataFrame.join"'))
305307
argparser.add_argument('--python-path',
306308
type=str,
307309
default=os.path.dirname(DOC_PATH),
@@ -323,7 +325,7 @@ def main():
323325
# the import of `python_path` correctly. The latter is used to resolve
324326
# the import within the module, injecting it into the global namespace
325327
os.environ['PYTHONPATH'] = args.python_path
326-
sys.path.append(args.python_path)
328+
sys.path.insert(0, args.python_path)
327329
globals()['pandas'] = importlib.import_module('pandas')
328330

329331
# Set the matplotlib backend to the non-interactive Agg backend for all

doc/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@
9898
if (fname == 'index.rst'
9999
and os.path.abspath(dirname) == source_path):
100100
continue
101-
elif pattern == '-api' and dirname == 'api':
101+
elif pattern == '-api' and dirname == 'reference':
102102
exclude_patterns.append(fname)
103-
elif fname != pattern:
103+
elif pattern != '-api' and fname != pattern:
104104
exclude_patterns.append(fname)
105105

106106
with open(os.path.join(source_path, 'index.rst.template')) as f:

doc/source/development/contributing.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Bug reports must:
5454
...
5555
```
5656

57-
#. Include the full version string of *pandas* and its dependencies. You can use the built in function::
57+
#. Include the full version string of *pandas* and its dependencies. You can use the built-in function::
5858

5959
>>> import pandas as pd
6060
>>> pd.show_versions()
@@ -178,6 +178,7 @@ We'll now kick off a three-step process:
178178
# Create and activate the build environment
179179
conda env create -f environment.yml
180180
conda activate pandas-dev
181+
conda uninstall --force pandas
181182
182183
# or with older versions of Anaconda:
183184
source activate pandas-dev
@@ -211,7 +212,7 @@ See the full conda docs `here <http://conda.pydata.org/docs>`__.
211212
Creating a Python Environment (pip)
212213
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
213214

214-
If you aren't using conda for you development environment, follow these instructions.
215+
If you aren't using conda for your development environment, follow these instructions.
215216
You'll need to have at least python3.5 installed on your system.
216217

217218
.. code-block:: none
@@ -428,14 +429,14 @@ reducing the turn-around time for checking your changes.
428429
python make.py clean
429430
python make.py --no-api
430431

431-
# compile the docs with only a single
432-
# section, that which is in indexing.rst
432+
# compile the docs with only a single section, relative to the "source" folder.
433+
# For example, compiling only this guide (docs/source/development/contributing.rst)
433434
python make.py clean
434-
python make.py --single indexing
435+
python make.py --single development/contributing.rst
435436

436437
# compile the reference docs for a single function
437438
python make.py clean
438-
python make.py --single DataFrame.join
439+
python make.py --single pandas.DataFrame.join
439440

440441
For comparison, a full documentation build may take 15 minutes, but a single
441442
section may take 15 seconds. Subsequent builds, which only process portions
@@ -484,7 +485,7 @@ contributing them to the project::
484485

485486
./ci/code_checks.sh
486487

487-
The script verify the linting of code files, it looks for common mistake patterns
488+
The script verifies the linting of code files, it looks for common mistake patterns
488489
(like missing spaces around sphinx directives that make the documentation not
489490
being rendered properly) and it also validates the doctests. It is possible to
490491
run the checks independently by using the parameters ``lint``, ``patterns`` and
@@ -675,7 +676,7 @@ Otherwise, you need to do it manually:
675676
676677
You'll also need to
677678

678-
1. write a new test that asserts a warning is issued when calling with the deprecated argument
679+
1. Write a new test that asserts a warning is issued when calling with the deprecated argument
679680
2. Update all of pandas existing tests and code to use the new argument
680681

681682
See :ref:`contributing.warnings` for more.
@@ -731,7 +732,7 @@ extensions in `numpy.testing
731732

732733
.. note::
733734

734-
The earliest supported pytest version is 3.6.0.
735+
The earliest supported pytest version is 4.0.2.
735736

736737
Writing tests
737738
~~~~~~~~~~~~~

doc/source/development/extending.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ decorate a class, providing the name of attribute to add. The class's
3333
3434
@staticmethod
3535
def _validate(obj):
36-
if 'lat' not in obj.columns or 'lon' not in obj.columns:
37-
raise AttributeError("Must have 'lat' and 'lon'.")
36+
# verify there is a column latitude and a column longitude
37+
if 'latitude' not in obj.columns or 'longitude' not in obj.columns:
38+
raise AttributeError("Must have 'latitude' and 'longitude'.")
3839
3940
@property
4041
def center(self):

doc/source/development/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
Development
77
===========
88

9+
.. If you update this toctree, also update the manual toctree in the
10+
main index.rst.template
11+
912
.. toctree::
1013
:maxdepth: 2
1114

doc/source/getting_started/10min.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Display the index, columns:
103103
df.columns
104104
105105
:meth:`DataFrame.to_numpy` gives a NumPy representation of the underlying data.
106-
Note that his can be an expensive operation when your :class:`DataFrame` has
106+
Note that this can be an expensive operation when your :class:`DataFrame` has
107107
columns with different data types, which comes down to a fundamental difference
108108
between pandas and NumPy: **NumPy arrays have one dtype for the entire array,
109109
while pandas DataFrames have one dtype per column**. When you call

0 commit comments

Comments
 (0)