Skip to content

Commit afd4a70

Browse files
author
Prabakaran Kumaresshan
committed
Merge branch 'master' into fix/combine-first
2 parents 115667e + a3da05a commit afd4a70

File tree

399 files changed

+13321
-9010
lines changed

Some content is hidden

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

399 files changed

+13321
-9010
lines changed

.github/workflows/pre-commit.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-python@v2
14+
- uses: pre-commit/[email protected]

.github/workflows/stale-pr.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: "Stale PRs"
22
on:
33
schedule:
44
# * is a special character in YAML so you have to quote this string
5-
- cron: "0 */6 * * *"
5+
- cron: "0 0 * * *"
66

77
jobs:
88
stale:
@@ -11,11 +11,11 @@ jobs:
1111
- uses: actions/stale@v3
1212
with:
1313
repo-token: ${{ secrets.GITHUB_TOKEN }}
14-
stale-pr-message: "This pull request is stale because it has been open for thirty days with no activity."
14+
stale-pr-message: "This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this."
1515
skip-stale-pr-message: false
1616
stale-pr-label: "Stale"
17-
exempt-pr-labels: "Needs Review,Blocked"
17+
exempt-pr-labels: "Needs Review,Blocked,Needs Discussion"
1818
days-before-stale: 30
1919
days-before-close: -1
20-
remove-stale-when-updated: true
21-
debug-only: true
20+
remove-stale-when-updated: false
21+
debug-only: false

.pre-commit-config.yaml

+22-9
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,45 @@
11
repos:
22
- repo: https://github.com/python/black
3-
rev: 19.10b0
3+
rev: 20.8b1
44
hooks:
55
- id: black
6-
language_version: python3
76
- repo: https://gitlab.com/pycqa/flake8
8-
rev: 3.7.7
7+
rev: 3.8.3
98
hooks:
109
- id: flake8
11-
language: python_venv
1210
additional_dependencies: [flake8-comprehensions>=3.1.0]
1311
- id: flake8
1412
name: flake8-pyx
15-
language: python_venv
1613
files: \.(pyx|pxd)$
1714
types:
1815
- file
1916
args: [--append-config=flake8/cython.cfg]
2017
- id: flake8
2118
name: flake8-pxd
22-
language: python_venv
2319
files: \.pxi\.in$
2420
types:
2521
- file
2622
args: [--append-config=flake8/cython-template.cfg]
27-
- repo: https://github.com/pre-commit/mirrors-isort
28-
rev: v4.3.21
23+
- repo: https://github.com/PyCQA/isort
24+
rev: 5.2.2
2925
hooks:
3026
- id: isort
31-
language: python_venv
3227
exclude: ^pandas/__init__\.py$|^pandas/core/api\.py$
28+
- repo: https://github.com/asottile/pyupgrade
29+
rev: v2.7.2
30+
hooks:
31+
- id: pyupgrade
32+
args: [--py37-plus]
33+
- repo: https://github.com/pre-commit/pygrep-hooks
34+
rev: v1.6.0
35+
hooks:
36+
- id: rst-backticks
37+
- repo: local
38+
hooks:
39+
- id: pip_to_conda
40+
name: Generate pip dependency from conda
41+
description: This hook checks if the conda environment.yml and requirements-dev.txt are equal
42+
language: system
43+
entry: python -m scripts.generate_pip_deps_from_conda
44+
files: ^(environment.yml|requirements-dev.txt)$
45+
pass_filenames: false

.travis.yml

+17-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
language: python
22
python: 3.7
33

4+
addons:
5+
apt:
6+
update: true
7+
packages:
8+
- xvfb
9+
10+
services:
11+
- xvfb
12+
413
# To turn off cached cython files and compiler cache
514
# set NOCACHE-true
615
# To delete caches go to https://travis-ci.org/OWNER/REPOSITORY/caches or run
@@ -10,46 +19,43 @@ cache:
1019
ccache: true
1120
directories:
1221
- $HOME/.cache # cython cache
13-
- $HOME/.ccache # compiler cache
1422

1523
env:
1624
global:
17-
# Variable for test workers
1825
- PYTEST_WORKERS="auto"
1926
# create a github personal access token
2027
# cd pandas-dev/pandas
2128
# travis encrypt 'PANDAS_GH_TOKEN=personal_access_token' -r pandas-dev/pandas
2229
- secure: "EkWLZhbrp/mXJOx38CHjs7BnjXafsqHtwxPQrqWy457VDFWhIY1DMnIR/lOWG+a20Qv52sCsFtiZEmMfUjf0pLGXOqurdxbYBGJ7/ikFLk9yV2rDwiArUlVM9bWFnFxHvdz9zewBH55WurrY4ShZWyV+x2dWjjceWG5VpWeI6sA="
2330

2431
git:
25-
# for cloning
2632
depth: false
2733

2834
matrix:
2935
fast_finish: true
3036

3137
include:
32-
# In allowed failures
3338
- dist: bionic
3439
python: 3.9-dev
3540
env:
3641
- JOB="3.9-dev" PATTERN="(not slow and not network and not clipboard)"
42+
3743
- env:
3844
- JOB="3.8" ENV_FILE="ci/deps/travis-38.yaml" PATTERN="(not slow and not network and not clipboard)"
3945

4046
- env:
4147
- JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="(not slow and not network and not clipboard)"
4248

43-
- arch: arm64
44-
env:
45-
- JOB="3.7, arm64" PYTEST_WORKERS=8 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard)"
46-
4749
- env:
4850
- JOB="3.7, locale" ENV_FILE="ci/deps/travis-37-locale.yaml" PATTERN="((not slow and not network and not clipboard) or (single and db))" LOCALE_OVERRIDE="zh_CN.UTF-8" SQL="1"
4951
services:
5052
- mysql
5153
- postgresql
5254

55+
- arch: arm64
56+
env:
57+
- JOB="3.7, arm64" PYTEST_WORKERS=1 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard and not arm_slow)"
58+
5359
- env:
5460
# Enabling Deprecations when running tests
5561
# PANDAS_TESTING_MODE="deprecate" causes DeprecationWarning messages to be displayed in the logs
@@ -58,13 +64,12 @@ matrix:
5864
services:
5965
- mysql
6066
- postgresql
67+
6168
allow_failures:
69+
# Moved to allowed_failures 2020-09-29 due to timeouts https://github.com/pandas-dev/pandas/issues/36719
6270
- arch: arm64
6371
env:
64-
- JOB="3.7, arm64" PYTEST_WORKERS=8 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard)"
65-
- dist: bionic
66-
env:
67-
- JOB="3.9-dev" PATTERN="(not slow and not network and not clipboard)"
72+
- JOB="3.7, arm64" PYTEST_WORKERS=1 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard and not arm_slow)"
6873

6974

7075
before_install:
@@ -78,12 +83,6 @@ before_install:
7883
- uname -a
7984
- git --version
8085
- ./ci/check_git_tags.sh
81-
# Because travis runs on Google Cloud and has a /etc/boto.cfg,
82-
# it breaks moto import, see:
83-
# https://github.com/spulec/moto/issues/1771
84-
# https://github.com/boto/boto/issues/3741
85-
# This overrides travis and tells it to look nowhere.
86-
- export BOTO_CONFIG=/dev/null
8786

8887
install:
8988
- echo "install start"

asv_bench/asv.conf.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
// followed by the pip installed packages).
4040
"matrix": {
4141
"numpy": [],
42-
"Cython": ["0.29.16"],
42+
"Cython": ["0.29.21"],
4343
"matplotlib": [],
4444
"sqlalchemy": [],
4545
"scipy": [],

asv_bench/benchmarks/arithmetic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def setup(self, op):
125125
arr1 = np.random.randn(n_rows, int(n_cols / 2)).astype("f8")
126126
arr2 = np.random.randn(n_rows, int(n_cols / 2)).astype("f4")
127127
df = pd.concat(
128-
[pd.DataFrame(arr1), pd.DataFrame(arr2)], axis=1, ignore_index=True,
128+
[pd.DataFrame(arr1), pd.DataFrame(arr2)], axis=1, ignore_index=True
129129
)
130130
# should already be the case, but just to be sure
131131
df._consolidate_inplace()

asv_bench/benchmarks/frame_methods.py

+40
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,46 @@ def time_to_html_mixed(self):
219219
self.df2.to_html()
220220

221221

222+
class ToNumpy:
223+
def setup(self):
224+
N = 10000
225+
M = 10
226+
self.df_tall = DataFrame(np.random.randn(N, M))
227+
self.df_wide = DataFrame(np.random.randn(M, N))
228+
self.df_mixed_tall = self.df_tall.copy()
229+
self.df_mixed_tall["foo"] = "bar"
230+
self.df_mixed_tall[0] = period_range("2000", periods=N)
231+
self.df_mixed_tall[1] = range(N)
232+
self.df_mixed_wide = self.df_wide.copy()
233+
self.df_mixed_wide["foo"] = "bar"
234+
self.df_mixed_wide[0] = period_range("2000", periods=M)
235+
self.df_mixed_wide[1] = range(M)
236+
237+
def time_to_numpy_tall(self):
238+
self.df_tall.to_numpy()
239+
240+
def time_to_numpy_wide(self):
241+
self.df_wide.to_numpy()
242+
243+
def time_to_numpy_mixed_tall(self):
244+
self.df_mixed_tall.to_numpy()
245+
246+
def time_to_numpy_mixed_wide(self):
247+
self.df_mixed_wide.to_numpy()
248+
249+
def time_values_tall(self):
250+
self.df_tall.values
251+
252+
def time_values_wide(self):
253+
self.df_wide.values
254+
255+
def time_values_mixed_tall(self):
256+
self.df_mixed_tall.values
257+
258+
def time_values_mixed_wide(self):
259+
self.df_mixed_wide.values
260+
261+
222262
class Repr:
223263
def setup(self):
224264
nrows = 10000

asv_bench/benchmarks/strings.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,20 @@ class Construction:
1313
param_names = ["dtype"]
1414

1515
def setup(self, dtype):
16-
self.data = tm.rands_array(nchars=10 ** 5, size=10)
16+
self.series_arr = tm.rands_array(nchars=10, size=10 ** 5)
17+
self.frame_arr = self.series_arr.reshape((50_000, 2)).copy()
1718

18-
def time_construction(self, dtype):
19-
Series(self.data, dtype=dtype)
19+
def time_series_construction(self, dtype):
20+
Series(self.series_arr, dtype=dtype)
2021

21-
def peakmem_construction(self, dtype):
22-
Series(self.data, dtype=dtype)
22+
def peakmem_series_construction(self, dtype):
23+
Series(self.series_arr, dtype=dtype)
24+
25+
def time_frame_construction(self, dtype):
26+
DataFrame(self.frame_arr, dtype=dtype)
27+
28+
def peakmem_frame_construction(self, dtype):
29+
DataFrame(self.frame_arr, dtype=dtype)
2330

2431

2532
class Methods:

asv_bench/benchmarks/timeseries.py

+23
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,29 @@ def time_lookup_and_cleanup(self):
263263
self.ts.index._cleanup()
264264

265265

266+
class ToDatetimeFromIntsFloats:
267+
def setup(self):
268+
self.ts_sec = Series(range(1521080307, 1521685107), dtype="int64")
269+
self.ts_sec_float = self.ts_sec.astype("float64")
270+
271+
self.ts_nanosec = 1_000_000 * self.ts_sec
272+
self.ts_nanosec_float = self.ts_nanosec.astype("float64")
273+
274+
# speed of int64 and float64 paths should be comparable
275+
276+
def time_nanosec_int64(self):
277+
to_datetime(self.ts_nanosec, unit="ns")
278+
279+
def time_nanosec_float64(self):
280+
to_datetime(self.ts_nanosec_float, unit="ns")
281+
282+
def time_sec_int64(self):
283+
to_datetime(self.ts_sec, unit="s")
284+
285+
def time_sec_float64(self):
286+
to_datetime(self.ts_sec_float, unit="s")
287+
288+
266289
class ToDatetimeYYYYMMDD:
267290
def setup(self):
268291
rng = date_range(start="1/1/2000", periods=10000, freq="D")

ci/build39.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
#!/bin/bash -e
22
# Special build for python3.9 until numpy puts its own wheels up
33

4-
sudo apt-get install build-essential gcc xvfb
54
pip install --no-deps -U pip wheel setuptools
6-
pip install numpy python-dateutil pytz pytest pytest-xdist hypothesis
7-
pip install cython --pre # https://github.com/cython/cython/issues/3395
5+
pip install cython numpy python-dateutil pytz pytest pytest-xdist hypothesis
86

97
python setup.py build_ext -inplace
108
python -m pip install --no-build-isolation -e .

ci/code_checks.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
335335
RET=$(($RET + $?)) ; echo $MSG "DONE"
336336

337337
MSG='Doctests strings.py' ; echo $MSG
338-
pytest -q --doctest-modules pandas/core/strings.py
338+
pytest -q --doctest-modules pandas/core/strings/
339339
RET=$(($RET + $?)) ; echo $MSG "DONE"
340340

341341
# Directories

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ dependencies:
2121
# see comment above
2222
- pip
2323
- pip:
24-
- cython>=0.29.16
24+
- cython>=0.29.21
2525
- numpy>=1.16.5
2626
- pytest>=5.0.1

ci/deps/azure-37-locale.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
- python=3.7.*
77

88
# tools
9-
- cython>=0.29.16
9+
- cython>=0.29.21
1010
- pytest>=5.0.1
1111
- pytest-xdist>=1.21
1212
- pytest-asyncio

ci/deps/azure-37-locale_slow.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
- python=3.7.*
77

88
# tools
9-
- cython>=0.29.16
9+
- cython>=0.29.21
1010
- pytest>=5.0.1
1111
- pytest-xdist>=1.21
1212
- hypothesis>=3.58.0

ci/deps/azure-37-minimum_versions.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies:
55
- python=3.7.1
66

77
# tools
8-
- cython=0.29.16
8+
- cython=0.29.21
99
- pytest=5.0.1
1010
- pytest-xdist>=1.21
1111
- hypothesis>=3.58.0
@@ -20,7 +20,7 @@ dependencies:
2020
- numexpr=2.6.8
2121
- numpy=1.16.5
2222
- openpyxl=2.6.0
23-
- pytables=3.4.4
23+
- pytables=3.5.1
2424
- python-dateutil=2.7.3
2525
- pytz=2017.3
2626
- pyarrow=0.15

ci/deps/azure-37-slow.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
- python=3.7.*
77

88
# tools
9-
- cython>=0.29.16
9+
- cython>=0.29.21
1010
- pytest>=5.0.1
1111
- pytest-xdist>=1.21
1212
- hypothesis>=3.58.0

ci/deps/azure-38-locale.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies:
55
- python=3.8.*
66

77
# tools
8-
- cython>=0.29.16
8+
- cython>=0.29.21
99
- pytest>=5.0.1
1010
- pytest-xdist>=1.21
1111
- pytest-asyncio>=0.12.0

0 commit comments

Comments
 (0)