Skip to content

Commit 6abe510

Browse files
committed
Merge branch 'master' of https://github.com/pandas-dev/pandas into 29485
2 parents 4bc517d + 0647f02 commit 6abe510

File tree

106 files changed

+2455
-2214
lines changed

Some content is hidden

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

106 files changed

+2455
-2214
lines changed

azure-pipelines.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,28 @@ jobs:
2626
parameters:
2727
name: Windows
2828
vmImage: vs2017-win2016
29+
30+
- job: py37_32bit
31+
pool:
32+
vmImage: ubuntu-18.04
33+
34+
steps:
35+
- script: |
36+
docker pull quay.io/pypa/manylinux2014_i686
37+
docker run -v $(pwd):/pandas quay.io/pypa/manylinux2014_i686 \
38+
/bin/bash -xc "cd pandas && \
39+
/opt/python/cp37-cp37m/bin/python -m venv ~/virtualenvs/pandas-dev && \
40+
. ~/virtualenvs/pandas-dev/bin/activate && \
41+
python -m pip install --no-deps -U pip wheel setuptools && \
42+
pip install cython numpy python-dateutil pytz pytest pytest-xdist hypothesis pytest-azurepipelines && \
43+
python setup.py build_ext -q -i -j2 && \
44+
python -m pip install --no-build-isolation -e . && \
45+
pytest -m 'not slow and not network and not clipboard' pandas --junitxml=test-data.xml"
46+
displayName: 'Run 32-bit manylinux2014 Docker Build / Tests'
47+
48+
- task: PublishTestResults@2
49+
condition: succeededOrFailed()
50+
inputs:
51+
testResultsFiles: '**/test-*.xml'
52+
failTaskOnFailedTests: true
53+
testRunTitle: 'Publish test results for Python 3.7-32 bit full Linux'

doc/redirects.csv

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,9 @@ generated/pandas.DatetimeIndex.date,../reference/api/pandas.DatetimeIndex.date
542542
generated/pandas.DatetimeIndex.day,../reference/api/pandas.DatetimeIndex.day
543543
generated/pandas.DatetimeIndex.day_name,../reference/api/pandas.DatetimeIndex.day_name
544544
generated/pandas.DatetimeIndex.dayofweek,../reference/api/pandas.DatetimeIndex.dayofweek
545+
generated/pandas.DatetimeIndex.day_of_week,../reference/api/pandas.DatetimeIndex.day_of_week
545546
generated/pandas.DatetimeIndex.dayofyear,../reference/api/pandas.DatetimeIndex.dayofyear
547+
generated/pandas.DatetimeIndex.day_of_year,../reference/api/pandas.DatetimeIndex.day_of_year
546548
generated/pandas.DatetimeIndex.floor,../reference/api/pandas.DatetimeIndex.floor
547549
generated/pandas.DatetimeIndex.freq,../reference/api/pandas.DatetimeIndex.freq
548550
generated/pandas.DatetimeIndex.freqstr,../reference/api/pandas.DatetimeIndex.freqstr
@@ -839,7 +841,9 @@ generated/pandas.option_context,../reference/api/pandas.option_context
839841
generated/pandas.Period.asfreq,../reference/api/pandas.Period.asfreq
840842
generated/pandas.Period.day,../reference/api/pandas.Period.day
841843
generated/pandas.Period.dayofweek,../reference/api/pandas.Period.dayofweek
844+
generated/pandas.Period.day_of_week,../reference/api/pandas.Period.day_of_week
842845
generated/pandas.Period.dayofyear,../reference/api/pandas.Period.dayofyear
846+
generated/pandas.Period.day_of_year,../reference/api/pandas.Period.day_of_year
843847
generated/pandas.Period.days_in_month,../reference/api/pandas.Period.days_in_month
844848
generated/pandas.Period.daysinmonth,../reference/api/pandas.Period.daysinmonth
845849
generated/pandas.Period.end_time,../reference/api/pandas.Period.end_time
@@ -850,7 +854,9 @@ generated/pandas.Period,../reference/api/pandas.Period
850854
generated/pandas.PeriodIndex.asfreq,../reference/api/pandas.PeriodIndex.asfreq
851855
generated/pandas.PeriodIndex.day,../reference/api/pandas.PeriodIndex.day
852856
generated/pandas.PeriodIndex.dayofweek,../reference/api/pandas.PeriodIndex.dayofweek
857+
generated/pandas.PeriodIndex.day_of_week,../reference/api/pandas.PeriodIndex.day_of_week
853858
generated/pandas.PeriodIndex.dayofyear,../reference/api/pandas.PeriodIndex.dayofyear
859+
generated/pandas.PeriodIndex.day_of_year,../reference/api/pandas.PeriodIndex.day_of_year
854860
generated/pandas.PeriodIndex.days_in_month,../reference/api/pandas.PeriodIndex.days_in_month
855861
generated/pandas.PeriodIndex.daysinmonth,../reference/api/pandas.PeriodIndex.daysinmonth
856862
generated/pandas.PeriodIndex.end_time,../reference/api/pandas.PeriodIndex.end_time
@@ -993,7 +999,9 @@ generated/pandas.Series.dt.date,../reference/api/pandas.Series.dt.date
993999
generated/pandas.Series.dt.day,../reference/api/pandas.Series.dt.day
9941000
generated/pandas.Series.dt.day_name,../reference/api/pandas.Series.dt.day_name
9951001
generated/pandas.Series.dt.dayofweek,../reference/api/pandas.Series.dt.dayofweek
1002+
generated/pandas.Series.dt.day_of_week,../reference/api/pandas.Series.dt.day_of_week
9961003
generated/pandas.Series.dt.dayofyear,../reference/api/pandas.Series.dt.dayofyear
1004+
generated/pandas.Series.dt.day_of_year,../reference/api/pandas.Series.dt.day_of_year
9971005
generated/pandas.Series.dt.days,../reference/api/pandas.Series.dt.days
9981006
generated/pandas.Series.dt.days_in_month,../reference/api/pandas.Series.dt.days_in_month
9991007
generated/pandas.Series.dt.daysinmonth,../reference/api/pandas.Series.dt.daysinmonth
@@ -1326,7 +1334,9 @@ generated/pandas.Timestamp.date,../reference/api/pandas.Timestamp.date
13261334
generated/pandas.Timestamp.day,../reference/api/pandas.Timestamp.day
13271335
generated/pandas.Timestamp.day_name,../reference/api/pandas.Timestamp.day_name
13281336
generated/pandas.Timestamp.dayofweek,../reference/api/pandas.Timestamp.dayofweek
1337+
generated/pandas.Timestamp.day_of_week,../reference/api/pandas.Timestamp.day_of_week
13291338
generated/pandas.Timestamp.dayofyear,../reference/api/pandas.Timestamp.dayofyear
1339+
generated/pandas.Timestamp.day_of_year,../reference/api/pandas.Timestamp.day_of_year
13301340
generated/pandas.Timestamp.days_in_month,../reference/api/pandas.Timestamp.days_in_month
13311341
generated/pandas.Timestamp.daysinmonth,../reference/api/pandas.Timestamp.daysinmonth
13321342
generated/pandas.Timestamp.dst,../reference/api/pandas.Timestamp.dst

doc/source/reference/arrays.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ Properties
6363
Timestamp.asm8
6464
Timestamp.day
6565
Timestamp.dayofweek
66+
Timestamp.day_of_week
6667
Timestamp.dayofyear
68+
Timestamp.day_of_year
6769
Timestamp.days_in_month
6870
Timestamp.daysinmonth
6971
Timestamp.fold
@@ -233,7 +235,9 @@ Properties
233235

234236
Period.day
235237
Period.dayofweek
238+
Period.day_of_week
236239
Period.dayofyear
240+
Period.day_of_year
237241
Period.days_in_month
238242
Period.daysinmonth
239243
Period.end_time

doc/source/reference/indexing.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,11 @@ Time/date components
345345
DatetimeIndex.time
346346
DatetimeIndex.timetz
347347
DatetimeIndex.dayofyear
348+
DatetimeIndex.day_of_year
348349
DatetimeIndex.weekofyear
349350
DatetimeIndex.week
350351
DatetimeIndex.dayofweek
352+
DatetimeIndex.day_of_week
351353
DatetimeIndex.weekday
352354
DatetimeIndex.quarter
353355
DatetimeIndex.tz
@@ -461,7 +463,9 @@ Properties
461463

462464
PeriodIndex.day
463465
PeriodIndex.dayofweek
466+
PeriodIndex.day_of_week
464467
PeriodIndex.dayofyear
468+
PeriodIndex.day_of_year
465469
PeriodIndex.days_in_month
466470
PeriodIndex.daysinmonth
467471
PeriodIndex.end_time

doc/source/reference/series.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,10 @@ Datetime properties
319319
Series.dt.week
320320
Series.dt.weekofyear
321321
Series.dt.dayofweek
322+
Series.dt.day_of_week
322323
Series.dt.weekday
323324
Series.dt.dayofyear
325+
Series.dt.day_of_year
324326
Series.dt.quarter
325327
Series.dt.is_month_start
326328
Series.dt.is_month_end

doc/source/user_guide/timeseries.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,9 +803,11 @@ There are several time/date properties that one can access from ``Timestamp`` or
803803
time,"Returns datetime.time (does not contain timezone information)"
804804
timetz,"Returns datetime.time as local time with timezone information"
805805
dayofyear,"The ordinal day of year"
806+
day_of_year,"The ordinal day of year"
806807
weekofyear,"The week ordinal of the year"
807808
week,"The week ordinal of the year"
808809
dayofweek,"The number of the day of the week with Monday=0, Sunday=6"
810+
day_of_week,"The number of the day of the week with Monday=0, Sunday=6"
809811
weekday,"The number of the day of the week with Monday=0, Sunday=6"
810812
quarter,"Quarter of the date: Jan-Mar = 1, Apr-Jun = 2, etc."
811813
days_in_month,"The number of days in the month of the datetime"

doc/source/whatsnew/v1.1.4.rst

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _whatsnew_114:
22

3-
What's new in 1.1.4 (??)
4-
------------------------
3+
What's new in 1.1.4 (October 30, 2020)
4+
--------------------------------------
55

66
These are the changes in pandas 1.1.4. See :ref:`release` for a full changelog
77
including other versions of pandas.
@@ -19,13 +19,15 @@ Fixed regressions
1919
- Fixed regression where :meth:`DataFrame.agg` would fail with :exc:`TypeError` when passed positional arguments to be passed on to the aggregation function (:issue:`36948`).
2020
- Fixed regression in :class:`RollingGroupby` with ``sort=False`` not being respected (:issue:`36889`)
2121
- Fixed regression in :meth:`Series.astype` converting ``None`` to ``"nan"`` when casting to string (:issue:`36904`)
22+
- Fixed regression in :meth:`Series.rank` method failing for read-only data (:issue:`37290`)
2223
- Fixed regression in :class:`RollingGroupby` causing a segmentation fault with Index of dtype object (:issue:`36727`)
2324
- Fixed regression in :meth:`DataFrame.resample(...).apply(...)` raised ``AttributeError`` when input was a :class:`DataFrame` and only a :class:`Series` was evaluated (:issue:`36951`)
2425
- Fixed regression in ``DataFrame.groupby(..).std()`` with nullable integer dtype (:issue:`37415`)
2526
- Fixed regression in :class:`PeriodDtype` comparing both equal and unequal to its string representation (:issue:`37265`)
2627
- Fixed regression where slicing :class:`DatetimeIndex` raised :exc:`AssertionError` on irregular time series with ``pd.NaT`` or on unsorted indices (:issue:`36953` and :issue:`35509`)
2728
- Fixed regression in certain offsets (:meth:`pd.offsets.Day() <pandas.tseries.offsets.Day>` and below) no longer being hashable (:issue:`37267`)
2829
- Fixed regression in :class:`StataReader` which required ``chunksize`` to be manually set when using an iterator to read a dataset (:issue:`37280`)
30+
- Fixed regression in setitem with :meth:`DataFrame.iloc` which raised error when trying to set a value while filtering with a boolean list (:issue:`36741`)
2931
- Fixed regression in :attr:`MultiIndex.is_monotonic_increasing` returning wrong results with ``NaN`` in at least one of the levels (:issue:`37220`)
3032

3133
.. ---------------------------------------------------------------------------
@@ -42,14 +44,6 @@ Bug fixes
4244

4345
.. ---------------------------------------------------------------------------
4446
45-
.. _whatsnew_114.other:
46-
47-
Other
48-
~~~~~
49-
-
50-
51-
.. ---------------------------------------------------------------------------
52-
5347
.. _whatsnew_114.contributors:
5448

5549
Contributors

doc/source/whatsnew/v1.2.0.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ level-by-level basis.
207207

208208
Other enhancements
209209
^^^^^^^^^^^^^^^^^^
210+
- Added ``day_of_week``(compatibility alias ``dayofweek``) property to ``Timestamp``, ``DatetimeIndex``, ``Period``, ``PeriodIndex`` (:issue:`9605`)
211+
- Added ``day_of_year`` (compatibility alias ``dayofyear``) property to ``Timestamp``, ``DatetimeIndex``, ``Period``, ``PeriodIndex`` (:issue:`9605`)
210212
- Added :meth:`~DataFrame.set_flags` for setting table-wide flags on a ``Series`` or ``DataFrame`` (:issue:`28394`)
211213
- :meth:`DataFrame.applymap` now supports ``na_action`` (:issue:`23803`)
212214
- :class:`Index` with object dtype supports division and multiplication (:issue:`34160`)
@@ -346,6 +348,7 @@ Performance improvements
346348
- Performance improvement in :meth:`RollingGroupby.count` (:issue:`35625`)
347349
- Small performance decrease to :meth:`Rolling.min` and :meth:`Rolling.max` for fixed windows (:issue:`36567`)
348350
- Reduced peak memory usage in :meth:`DataFrame.to_pickle` when using ``protocol=5`` in python 3.8+ (:issue:`34244`)
351+
- faster ``dir`` calls when many index labels, e.g. ``dir(ser)`` (:issue:`37450`)
349352
- Performance improvement in :class:`ExpandingGroupby` (:issue:`37064`)
350353

351354
.. ---------------------------------------------------------------------------
@@ -404,6 +407,7 @@ Numeric
404407
- Bug in :class:`IntervalArray` comparisons with :class:`Series` not returning :class:`Series` (:issue:`36908`)
405408
- Bug in :class:`DataFrame` allowing arithmetic operations with list of array-likes with undefined results. Behavior changed to raising ``ValueError`` (:issue:`36702`)
406409
- Bug in :meth:`DataFrame.std`` with ``timedelta64`` dtype and ``skipna=False`` (:issue:`37392`)
410+
- Bug in :meth:`DataFrame.min` and :meth:`DataFrame.max` with ``datetime64`` dtype and ``skipna=False`` (:issue:`36907`)
407411

408412
Conversion
409413
^^^^^^^^^^

pandas/_libs/algos.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def nancorr(const float64_t[:, :] mat, bint cov=False, minp=None):
325325

326326
@cython.boundscheck(False)
327327
@cython.wraparound(False)
328-
def nancorr_spearman(const float64_t[:, :] mat, Py_ssize_t minp=1) -> ndarray:
328+
def nancorr_spearman(ndarray[float64_t, ndim=2] mat, Py_ssize_t minp=1) -> ndarray:
329329
cdef:
330330
Py_ssize_t i, j, xi, yi, N, K
331331
ndarray[float64_t, ndim=2] result
@@ -799,7 +799,7 @@ ctypedef fused rank_t:
799799
@cython.wraparound(False)
800800
@cython.boundscheck(False)
801801
def rank_1d(
802-
rank_t[:] in_arr,
802+
ndarray[rank_t, ndim=1] in_arr,
803803
ties_method="average",
804804
bint ascending=True,
805805
na_option="keep",
@@ -1018,7 +1018,7 @@ def rank_1d(
10181018

10191019

10201020
def rank_2d(
1021-
rank_t[:, :] in_arr,
1021+
ndarray[rank_t, ndim=2] in_arr,
10221022
int axis=0,
10231023
ties_method="average",
10241024
bint ascending=True,

pandas/_libs/lib.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ from numpy cimport (
3636
float32_t,
3737
float64_t,
3838
int64_t,
39+
intp_t,
3940
ndarray,
4041
uint8_t,
4142
uint64_t,
@@ -490,7 +491,7 @@ def has_infs_f8(const float64_t[:] arr) -> bool:
490491
return False
491492

492493

493-
def maybe_indices_to_slice(ndarray[int64_t] indices, int max_len):
494+
def maybe_indices_to_slice(ndarray[intp_t] indices, int max_len):
494495
cdef:
495496
Py_ssize_t i, n = len(indices)
496497
int k, vstart, vlast, v

pandas/_libs/tslibs/nattype.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,12 @@ class NaTType(_NaT):
357357

358358
week = property(fget=lambda self: np.nan)
359359
dayofyear = property(fget=lambda self: np.nan)
360+
day_of_year = property(fget=lambda self: np.nan)
360361
weekofyear = property(fget=lambda self: np.nan)
361362
days_in_month = property(fget=lambda self: np.nan)
362363
daysinmonth = property(fget=lambda self: np.nan)
363364
dayofweek = property(fget=lambda self: np.nan)
365+
day_of_week = property(fget=lambda self: np.nan)
364366

365367
# inject Timedelta properties
366368
days = property(fget=lambda self: np.nan)

pandas/_libs/tslibs/period.pyx

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,7 @@ cdef accessor _get_accessor_func(str field):
13731373
return <accessor>pweek
13741374
elif field == "day_of_year":
13751375
return <accessor>pday_of_year
1376-
elif field == "weekday":
1376+
elif field == "weekday" or field == "day_of_week":
13771377
return <accessor>pweekday
13781378
elif field == "days_in_month":
13791379
return <accessor>pdays_in_month
@@ -1475,6 +1475,9 @@ cdef class _Period(PeriodMixin):
14751475
PeriodDtypeBase _dtype
14761476
BaseOffset freq
14771477

1478+
dayofweek = _Period.day_of_week
1479+
dayofyear = _Period.day_of_year
1480+
14781481
def __cinit__(self, int64_t ordinal, BaseOffset freq):
14791482
self.ordinal = ordinal
14801483
self.freq = freq
@@ -1882,7 +1885,7 @@ cdef class _Period(PeriodMixin):
18821885
return self.weekofyear
18831886

18841887
@property
1885-
def dayofweek(self) -> int:
1888+
def day_of_week(self) -> int:
18861889
"""
18871890
Day of the week the period lies in, with Monday=0 and Sunday=6.
18881891

@@ -1900,33 +1903,33 @@ cdef class _Period(PeriodMixin):
19001903

19011904
See Also
19021905
--------
1903-
Period.dayofweek : Day of the week the period lies in.
1904-
Period.weekday : Alias of Period.dayofweek.
1906+
Period.day_of_week : Day of the week the period lies in.
1907+
Period.weekday : Alias of Period.day_of_week.
19051908
Period.day : Day of the month.
19061909
Period.dayofyear : Day of the year.
19071910

19081911
Examples
19091912
--------
19101913
>>> per = pd.Period('2017-12-31 22:00', 'H')
1911-
>>> per.dayofweek
1914+
>>> per.day_of_week
19121915
6
19131916

19141917
For periods that span over multiple days, the day at the beginning of
19151918
the period is returned.
19161919

19171920
>>> per = pd.Period('2017-12-31 22:00', '4H')
1918-
>>> per.dayofweek
1921+
>>> per.day_of_week
19191922
6
1920-
>>> per.start_time.dayofweek
1923+
>>> per.start_time.day_of_week
19211924
6
19221925

19231926
For periods with a frequency higher than days, the last day of the
19241927
period is returned.
19251928

19261929
>>> per = pd.Period('2018-01', 'M')
1927-
>>> per.dayofweek
1930+
>>> per.day_of_week
19281931
2
1929-
>>> per.end_time.dayofweek
1932+
>>> per.end_time.day_of_week
19301933
2
19311934
"""
19321935
base = self._dtype._dtype_code
@@ -1986,7 +1989,7 @@ cdef class _Period(PeriodMixin):
19861989
return self.dayofweek
19871990

19881991
@property
1989-
def dayofyear(self) -> int:
1992+
def day_of_year(self) -> int:
19901993
"""
19911994
Return the day of the year.
19921995

@@ -2002,19 +2005,19 @@ cdef class _Period(PeriodMixin):
20022005
See Also
20032006
--------
20042007
Period.day : Return the day of the month.
2005-
Period.dayofweek : Return the day of week.
2006-
PeriodIndex.dayofyear : Return the day of year of all indexes.
2008+
Period.day_of_week : Return the day of week.
2009+
PeriodIndex.day_of_year : Return the day of year of all indexes.
20072010

20082011
Examples
20092012
--------
20102013
>>> period = pd.Period("2015-10-23", freq='H')
2011-
>>> period.dayofyear
2014+
>>> period.day_of_year
20122015
296
20132016
>>> period = pd.Period("2012-12-31", freq='D')
2014-
>>> period.dayofyear
2017+
>>> period.day_of_year
20152018
366
20162019
>>> period = pd.Period("2013-01-01", freq='D')
2017-
>>> period.dayofyear
2020+
>>> period.day_of_year
20182021
1
20192022
"""
20202023
base = self._dtype._dtype_code

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,8 @@ cdef class _Timedelta(timedelta):
10561056

10571057
See Also
10581058
--------
1059-
Timestamp.isoformat
1059+
Timestamp.isoformat : Function is used to convert the given
1060+
Timestamp object into the ISO format.
10601061

10611062
Notes
10621063
-----

0 commit comments

Comments
 (0)