Skip to content

Commit fa347bb

Browse files
committed
Merge branch 'master' into index_str_partition_not_nan_safe
2 parents f13553f + e98032d commit fa347bb

File tree

421 files changed

+8559
-5535
lines changed

Some content is hidden

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

421 files changed

+8559
-5535
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,5 @@ doc/build/html/index.html
109109
# Windows specific leftover:
110110
doc/tmp.sv
111111
doc/source/styled.xlsx
112-
doc/source/templates/
113112
env/
114113
doc/source/savefig/

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ env:
2323

2424
git:
2525
# for cloning
26-
depth: 1000
26+
depth: 1500
2727

2828
matrix:
2929
fast_finish: true

ci/build_docs.sh

+2-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ "${TRAVIS_OS_NAME}" != "linux" ]; then
55
exit 0
66
fi
77

8-
cd "$TRAVIS_BUILD_DIR"
8+
cd "$TRAVIS_BUILD_DIR"/doc
99
echo "inside $0"
1010

1111
if [ "$DOC" ]; then
@@ -14,10 +14,6 @@ if [ "$DOC" ]; then
1414

1515
source activate pandas
1616

17-
mv "$TRAVIS_BUILD_DIR"/doc /tmp
18-
mv "$TRAVIS_BUILD_DIR/LICENSE" /tmp # included in the docs.
19-
cd /tmp/doc
20-
2117
echo ###############################
2218
echo # Log file for the doc build #
2319
echo ###############################
@@ -29,7 +25,7 @@ if [ "$DOC" ]; then
2925
echo # Create and send docs #
3026
echo ########################
3127

32-
cd /tmp/doc/build/html
28+
cd build/html
3329
git config --global user.email "[email protected]"
3430
git config --global user.name "pandas-docs-bot"
3531

ci/code_checks.sh

+30-6
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,19 @@
99
# In the future we may want to add the validation of docstrings and other checks here.
1010
#
1111
# Usage:
12-
# $ ./ci/code_checks.sh # run all checks
13-
# $ ./ci/code_checks.sh lint # run linting only
14-
# $ ./ci/code_checks.sh patterns # check for patterns that should not exist
15-
# $ ./ci/code_checks.sh doctests # run doctests
12+
# $ ./ci/code_checks.sh # run all checks
13+
# $ ./ci/code_checks.sh lint # run linting only
14+
# $ ./ci/code_checks.sh patterns # check for patterns that should not exist
15+
# $ ./ci/code_checks.sh doctests # run doctests
16+
# $ ./ci/code_checks.sh dependencies # check that dependencies are consistent
1617

1718
echo "inside $0"
1819
[[ $LINT ]] || { echo "NOT Linting. To lint use: LINT=true $0 $1"; exit 0; }
19-
[[ -z "$1" || "$1" == "lint" || "$1" == "patterns" || "$1" == "doctests" ]] || { echo "Unknown command $1. Usage: $0 [lint|patterns|doctests]"; exit 9999; }
20+
[[ -z "$1" || "$1" == "lint" || "$1" == "patterns" || "$1" == "doctests" || "$1" == "dependencies" ]] \
21+
|| { echo "Unknown command $1. Usage: $0 [lint|patterns|doctests|dependencies]"; exit 9999; }
2022

2123
source activate pandas
24+
BASE_DIR="$(dirname $0)/.."
2225
RET=0
2326
CHECK=$1
2427

@@ -44,6 +47,13 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
4447
flake8 pandas/_libs --filename=*.pxi.in,*.pxd --select=E501,E302,E203,E111,E114,E221,E303,E231,E126,F403
4548
RET=$(($RET + $?)) ; echo $MSG "DONE"
4649

50+
echo "flake8-rst --version"
51+
flake8-rst --version
52+
53+
MSG='Linting code-blocks in .rst documentation' ; echo $MSG
54+
flake8-rst doc/source --filename=*.rst
55+
RET=$(($RET + $?)) ; echo $MSG "DONE"
56+
4757
# Check that cython casting is of the form `<type>obj` as opposed to `<type> obj`;
4858
# it doesn't make a difference, but we want to be internally consistent.
4959
# Note: this grep pattern is (intended to be) equivalent to the python
@@ -64,6 +74,9 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
6474
cpplint --quiet --extensions=c,h --headers=h --recursive --filter=-readability/casting,-runtime/int,-build/include_subdir pandas/_libs/src/*.h pandas/_libs/src/parser pandas/_libs/ujson pandas/_libs/tslibs/src/datetime
6575
RET=$(($RET + $?)) ; echo $MSG "DONE"
6676

77+
echo "isort --version-number"
78+
isort --version-number
79+
6780
# Imports - Check formatting using isort see setup.cfg for settings
6881
MSG='Check import format using isort ' ; echo $MSG
6982
isort --recursive --check-only pandas
@@ -109,6 +122,10 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
109122
! grep -R --include="*.py" --include="*.pyx" --include="*.rst" -E "\.\. (autosummary|contents|currentmodule|deprecated|function|image|important|include|ipython|literalinclude|math|module|note|raw|seealso|toctree|versionadded|versionchanged|warning):[^:]" ./pandas ./doc/source
110123
RET=$(($RET + $?)) ; echo $MSG "DONE"
111124

125+
MSG='Check that the deprecated `assert_raises_regex` is not used (`pytest.raises(match=pattern)` should be used instead)' ; echo $MSG
126+
! grep -R --exclude=*.pyc --exclude=testing.py --exclude=test_testing.py assert_raises_regex pandas
127+
RET=$(($RET + $?)) ; echo $MSG "DONE"
128+
112129
MSG='Check for modules that pandas should not import' ; echo $MSG
113130
python -c "
114131
import sys
@@ -141,7 +158,7 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
141158

142159
MSG='Doctests generic.py' ; echo $MSG
143160
pytest -q --doctest-modules pandas/core/generic.py \
144-
-k"-_set_axis_name -_xs -describe -droplevel -groupby -interpolate -pct_change -pipe -reindex -reindex_axis -resample -to_json -transpose -values -xs"
161+
-k"-_set_axis_name -_xs -describe -droplevel -groupby -interpolate -pct_change -pipe -reindex -reindex_axis -to_json -transpose -values -xs"
145162
RET=$(($RET + $?)) ; echo $MSG "DONE"
146163

147164
MSG='Doctests top-level reshaping functions' ; echo $MSG
@@ -162,4 +179,11 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
162179

163180
fi
164181

182+
### DEPENDENCIES ###
183+
if [[ -z "$CHECK" || "$CHECK" == "dependencies" ]]; then
184+
MSG='Check that requirements-dev.txt has been generated from environment.yml' ; echo $MSG
185+
$BASE_DIR/scripts/generate_pip_deps_from_conda.py --compare
186+
RET=$(($RET + $?)) ; echo $MSG "DONE"
187+
fi
188+
165189
exit $RET

ci/deps/travis-36-doc.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ dependencies:
88
- bottleneck
99
- cython>=0.28.2
1010
- fastparquet
11+
- gitpython
1112
- html5lib
1213
- hypothesis>=3.58.0
1314
- ipykernel
14-
- ipython==6.5.0
15+
- ipython
1516
- ipywidgets
1617
- lxml
1718
- matplotlib

ci/deps/travis-36.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dependencies:
99
- fastparquet
1010
- flake8>=3.5
1111
- flake8-comprehensions
12+
- flake8-rst=0.4.2
1213
- gcsfs
1314
- geopandas
1415
- html5lib

ci/environment-dev.yaml

-19
This file was deleted.

ci/requirements-optional-conda.txt

-28
This file was deleted.

ci/requirements_dev.txt

-15
This file was deleted.

doc/make.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,12 @@ def _process_single_doc(self, single_doc):
126126
self.single_doc = 'api'
127127
elif os.path.exists(os.path.join(SOURCE_PATH, single_doc)):
128128
self.single_doc_type = 'rst'
129-
self.single_doc = os.path.splitext(os.path.basename(single_doc))[0]
129+
130+
if 'whatsnew' in single_doc:
131+
basename = single_doc
132+
else:
133+
basename = os.path.basename(single_doc)
134+
self.single_doc = os.path.splitext(basename)[0]
130135
elif os.path.exists(
131136
os.path.join(SOURCE_PATH, '{}.rst'.format(single_doc))):
132137
self.single_doc_type = 'rst'

doc/source/10min.rst

+28-28
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ a default integer index:
4545

4646
.. ipython:: python
4747
48-
s = pd.Series([1,3,5,np.nan,6,8])
48+
s = pd.Series([1, 3, 5, np.nan, 6, 8])
4949
s
5050
5151
Creating a :class:`DataFrame` by passing a NumPy array, with a datetime index
@@ -62,12 +62,12 @@ Creating a ``DataFrame`` by passing a dict of objects that can be converted to s
6262

6363
.. ipython:: python
6464
65-
df2 = pd.DataFrame({ 'A' : 1.,
66-
'B' : pd.Timestamp('20130102'),
67-
'C' : pd.Series(1,index=list(range(4)),dtype='float32'),
68-
'D' : np.array([3] * 4,dtype='int32'),
69-
'E' : pd.Categorical(["test","train","test","train"]),
70-
'F' : 'foo' })
65+
df2 = pd.DataFrame({'A': 1.,
66+
'B': pd.Timestamp('20130102'),
67+
'C': pd.Series(1, index=list(range(4)),dtype='float32'),
68+
'D': np.array([3] * 4, dtype='int32'),
69+
'E': pd.Categorical(["test", "train", "test", "train"]),
70+
'F': 'foo'})
7171
df2
7272
7373
The columns of the resulting ``DataFrame`` have different
@@ -283,9 +283,9 @@ Using the :func:`~Series.isin` method for filtering:
283283
.. ipython:: python
284284
285285
df2 = df.copy()
286-
df2['E'] = ['one', 'one','two','three','four','three']
286+
df2['E'] = ['one', 'one', 'two', 'three', 'four', 'three']
287287
df2
288-
df2[df2['E'].isin(['two','four'])]
288+
df2[df2['E'].isin(['two', 'four'])]
289289
290290
Setting
291291
~~~~~~~
@@ -295,7 +295,7 @@ by the indexes.
295295

296296
.. ipython:: python
297297
298-
s1 = pd.Series([1,2,3,4,5,6], index=pd.date_range('20130102', periods=6))
298+
s1 = pd.Series([1, 2, 3, 4, 5, 6], index=pd.date_range('20130102', periods=6))
299299
s1
300300
df['F'] = s1
301301
@@ -394,7 +394,7 @@ In addition, pandas automatically broadcasts along the specified dimension.
394394

395395
.. ipython:: python
396396
397-
s = pd.Series([1,3,5,np.nan,6,8], index=dates).shift(2)
397+
s = pd.Series([1, 3, 5, np.nan, 6, 8], index=dates).shift(2)
398398
s
399399
df.sub(s, axis='index')
400400
@@ -492,7 +492,7 @@ section.
492492

493493
.. ipython:: python
494494
495-
df = pd.DataFrame(np.random.randn(8, 4), columns=['A','B','C','D'])
495+
df = pd.DataFrame(np.random.randn(8, 4), columns=['A', 'B', 'C', 'D'])
496496
df
497497
s = df.iloc[3]
498498
df.append(s, ignore_index=True)
@@ -512,12 +512,12 @@ See the :ref:`Grouping section <groupby>`.
512512

513513
.. ipython:: python
514514
515-
df = pd.DataFrame({'A' : ['foo', 'bar', 'foo', 'bar',
516-
'foo', 'bar', 'foo', 'foo'],
517-
'B' : ['one', 'one', 'two', 'three',
518-
'two', 'two', 'one', 'three'],
519-
'C' : np.random.randn(8),
520-
'D' : np.random.randn(8)})
515+
df = pd.DataFrame({'A': ['foo', 'bar', 'foo', 'bar',
516+
'foo', 'bar', 'foo', 'foo'],
517+
'B': ['one', 'one', 'two', 'three',
518+
'two', 'two', 'one', 'three'],
519+
'C': np.random.randn(8),
520+
'D': np.random.randn(8)})
521521
df
522522
523523
Grouping and then applying the :meth:`~DataFrame.sum` function to the resulting
@@ -532,7 +532,7 @@ apply the ``sum`` function.
532532

533533
.. ipython:: python
534534
535-
df.groupby(['A','B']).sum()
535+
df.groupby(['A', 'B']).sum()
536536
537537
Reshaping
538538
---------
@@ -578,11 +578,11 @@ See the section on :ref:`Pivot Tables <reshaping.pivot>`.
578578

579579
.. ipython:: python
580580
581-
df = pd.DataFrame({'A' : ['one', 'one', 'two', 'three'] * 3,
582-
'B' : ['A', 'B', 'C'] * 4,
583-
'C' : ['foo', 'foo', 'foo', 'bar', 'bar', 'bar'] * 2,
584-
'D' : np.random.randn(12),
585-
'E' : np.random.randn(12)})
581+
df = pd.DataFrame({'A': ['one', 'one', 'two', 'three'] * 3,
582+
'B': ['A', 'B', 'C'] * 4,
583+
'C': ['foo', 'foo', 'foo', 'bar', 'bar', 'bar'] * 2,
584+
'D': np.random.randn(12),
585+
'E': np.random.randn(12)})
586586
df
587587
588588
We can produce pivot tables from this data very easily:
@@ -653,7 +653,7 @@ pandas can include categorical data in a ``DataFrame``. For full docs, see the
653653

654654
.. ipython:: python
655655
656-
df = pd.DataFrame({"id":[1,2,3,4,5,6], "raw_grade":['a', 'b', 'b', 'a', 'a', 'e']})
656+
df = pd.DataFrame({"id":[1, 2, 3, 4, 5, 6], "raw_grade":['a', 'b', 'b', 'a', 'a', 'e']})
657657
658658
Convert the raw grades to a categorical data type.
659659

@@ -753,13 +753,13 @@ Writing to a HDF5 Store.
753753

754754
.. ipython:: python
755755
756-
df.to_hdf('foo.h5','df')
756+
df.to_hdf('foo.h5', 'df')
757757
758758
Reading from a HDF5 Store.
759759

760760
.. ipython:: python
761761
762-
pd.read_hdf('foo.h5','df')
762+
pd.read_hdf('foo.h5', 'df')
763763
764764
.. ipython:: python
765765
:suppress:
@@ -796,7 +796,7 @@ If you are attempting to perform an operation you might see an exception like:
796796
.. code-block:: python
797797
798798
>>> if pd.Series([False, True, False]):
799-
print("I was true")
799+
... print("I was true")
800800
Traceback
801801
...
802802
ValueError: The truth value of an array is ambiguous. Use a.empty, a.any() or a.all().

0 commit comments

Comments
 (0)