Skip to content

Commit c290976

Browse files
author
Mateusz
committed
Merge remote-tracking branch 'upstream/main' into typ-fix-io-stata-type-ignores
2 parents 55de270 + 6033ed4 commit c290976

Some content is hidden

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

51 files changed

+615
-424
lines changed

.github/workflows/posix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ jobs:
162162
shell: bash
163163
run: |
164164
# TODO: re-enable cov, its slowing the tests down though
165-
pip install Cython numpy python-dateutil pytz pytest>=6.0 pytest-xdist>=1.31.0 hypothesis>=5.5.3
165+
pip install Cython numpy python-dateutil pytz pytest>=6.0 pytest-xdist>=1.31.0 pytest-asyncio hypothesis>=5.5.3
166166
if: ${{ env.IS_PYPY == 'true' }}
167167

168168
- name: Build Pandas

asv_bench/benchmarks/categoricals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def time_remove_categories(self):
187187
class Rank:
188188
def setup(self):
189189
N = 10**5
190-
ncats = 100
190+
ncats = 15
191191

192192
self.s_str = pd.Series(tm.makeCategoricalIndex(N, ncats)).astype(str)
193193
self.s_str_cat = pd.Series(self.s_str, dtype="category")

doc/source/whatsnew/v1.4.2.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Fixed regressions
1919
- Fixed memory performance regression in :meth:`Series.fillna` when called on a :class:`DataFrame` column with ``inplace=True`` (:issue:`46149`)
2020
- Provided an alternative solution for passing custom Excel formats in :meth:`.Styler.to_excel`, which was a regression based on stricter CSS validation. Examples available in the documentation for :meth:`.Styler.format` (:issue:`46152`)
2121
- Fixed regression in :meth:`DataFrame.replace` when a replacement value was also a target for replacement (:issue:`46306`)
22+
- Fixed regression in :meth:`DataFrame.replace` when the replacement value was explicitly ``None`` when passed in a dictionary to ``to_replace`` (:issue:`45601`, :issue:`45836`)
2223
- Fixed regression when setting values with :meth:`DataFrame.loc` losing :class:`MultiIndex` names if :class:`DataFrame` was empty before (:issue:`46317`)
2324
-
2425

doc/source/whatsnew/v1.5.0.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ Other Deprecations
342342
- Deprecated allowing non-keyword arguments in :meth:`ExtensionArray.argsort` (:issue:`46134`)
343343
- Deprecated treating all-bool ``object``-dtype columns as bool-like in :meth:`DataFrame.any` and :meth:`DataFrame.all` with ``bool_only=True``, explicitly cast to bool instead (:issue:`46188`)
344344
- Deprecated behavior of method :meth:`DataFrame.quantile`, attribute ``numeric_only`` will default False. Including datetime/timedelta columns in the result (:issue:`7308`).
345+
- Deprecated :attr:`Timedelta.freq` and :attr:`Timedelta.is_populated` (:issue:`46430`)
345346
-
346347

347348
.. ---------------------------------------------------------------------------
@@ -503,6 +504,7 @@ Groupby/resample/rolling
503504
- Bug in :meth:`.GroupBy.cumsum` with ``timedelta64[ns]`` dtype failing to recognize ``NaT`` as a null value (:issue:`46216`)
504505
- Bug in :meth:`GroupBy.cummin` and :meth:`GroupBy.cummax` with nullable dtypes incorrectly altering the original data in place (:issue:`46220`)
505506
- Bug in :meth:`GroupBy.cummax` with ``int64`` dtype with leading value being the smallest possible int64 (:issue:`46382`)
507+
- Bug in :meth:`GroupBy.max` with empty groups and ``uint64`` dtype incorrectly raising ``RuntimeError`` (:issue:`46408`)
506508
-
507509

508510
Reshaping

pandas/_libs/hashing.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def hash_object_array(
5353
"""
5454
cdef:
5555
Py_ssize_t i, n
56-
uint64_t[:] result
56+
uint64_t[::1] result
5757
bytes data, k
5858
uint8_t *kb
5959
uint64_t *lens

pandas/_libs/hashtable_class_helper.pxi.in

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ cdef class {{name}}HashTable(HashTable):
503503
int ret = 0
504504
{{c_type}} val
505505
khiter_t k
506-
intp_t[:] locs = np.empty(n, dtype=np.intp)
506+
intp_t[::1] locs = np.empty(n, dtype=np.intp)
507507

508508
with nogil:
509509
for i in range(n):
@@ -561,7 +561,7 @@ cdef class {{name}}HashTable(HashTable):
561561
"""
562562
cdef:
563563
Py_ssize_t i, idx, count = count_prior, n = len(values)
564-
intp_t[:] labels
564+
intp_t[::1] labels
565565
int ret = 0
566566
{{c_type}} val, na_value2
567567
khiter_t k
@@ -710,7 +710,7 @@ cdef class {{name}}HashTable(HashTable):
710710
# tuple[np.ndarray[np.intp], np.ndarray[{{dtype}}]]
711711
cdef:
712712
Py_ssize_t i, n = len(values)
713-
intp_t[:] labels
713+
intp_t[::1] labels
714714
Py_ssize_t idx, count = 0
715715
int ret = 0
716716
{{c_type}} val
@@ -848,7 +848,7 @@ cdef class StringHashTable(HashTable):
848848
object val
849849
const char *v
850850
khiter_t k
851-
intp_t[:] locs = np.empty(n, dtype=np.intp)
851+
intp_t[::1] locs = np.empty(n, dtype=np.intp)
852852

853853
# these by-definition *must* be strings
854854
vecs = <const char **>malloc(n * sizeof(char *))
@@ -946,8 +946,8 @@ cdef class StringHashTable(HashTable):
946946
"""
947947
cdef:
948948
Py_ssize_t i, idx, count = count_prior, n = len(values)
949-
intp_t[:] labels
950-
int64_t[:] uindexer
949+
intp_t[::1] labels
950+
int64_t[::1] uindexer
951951
int ret = 0
952952
object val
953953
const char *v
@@ -1168,7 +1168,7 @@ cdef class PyObjectHashTable(HashTable):
11681168
int ret = 0
11691169
object val
11701170
khiter_t k
1171-
intp_t[:] locs = np.empty(n, dtype=np.intp)
1171+
intp_t[::1] locs = np.empty(n, dtype=np.intp)
11721172

11731173
for i in range(n):
11741174
val = values[i]
@@ -1223,7 +1223,7 @@ cdef class PyObjectHashTable(HashTable):
12231223
"""
12241224
cdef:
12251225
Py_ssize_t i, idx, count = count_prior, n = len(values)
1226-
intp_t[:] labels
1226+
intp_t[::1] labels
12271227
int ret = 0
12281228
object val
12291229
khiter_t k

pandas/_libs/hashtable_func_helper.pxi.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ cdef value_count_{{dtype}}(const {{dtype}}_t[:] values, bint dropna):
8585
{{endif}}
8686

8787
# collect counts in the order corresponding to result_keys:
88-
cdef int64_t[:] result_counts = np.empty(table.size, dtype=np.int64)
88+
cdef:
89+
int64_t[::1] result_counts = np.empty(table.size, dtype=np.int64)
90+
8991
for i in range(table.size):
9092
{{if dtype == 'object'}}
9193
k = kh_get_{{ttype}}(table, result_keys.data[i])
@@ -366,7 +368,7 @@ def mode(ndarray[htfunc_t] values, bint dropna):
366368
ndarray[htfunc_t] keys
367369
ndarray[htfunc_t] modes
368370

369-
int64_t[:] counts
371+
int64_t[::1] counts
370372
int64_t count, max_count = -1
371373
Py_ssize_t nkeys, k, j = 0
372374

pandas/_libs/interval.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ from operator import (
55
)
66

77
from cpython.datetime cimport (
8-
PyDateTime_IMPORT,
98
PyDelta_Check,
9+
import_datetime,
1010
)
1111

12-
PyDateTime_IMPORT
12+
import_datetime()
1313

1414
from cpython.object cimport (
1515
Py_EQ,

pandas/_libs/lib.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ from cython import Py_ssize_t
99
from cpython.datetime cimport (
1010
PyDate_Check,
1111
PyDateTime_Check,
12-
PyDateTime_IMPORT,
1312
PyDelta_Check,
1413
PyTime_Check,
14+
import_datetime,
1515
)
1616
from cpython.iterator cimport PyIter_Check
1717
from cpython.number cimport PyNumber_Check
@@ -27,7 +27,7 @@ from cpython.tuple cimport (
2727
)
2828
from cython cimport floating
2929

30-
PyDateTime_IMPORT
30+
import_datetime()
3131

3232
import numpy as np
3333

@@ -2470,8 +2470,8 @@ def maybe_convert_objects(ndarray[object] objects,
24702470
ndarray[int64_t] ints
24712471
ndarray[uint64_t] uints
24722472
ndarray[uint8_t] bools
2473-
int64_t[:] idatetimes
2474-
int64_t[:] itimedeltas
2473+
int64_t[::1] idatetimes
2474+
int64_t[::1] itimedeltas
24752475
Seen seen = Seen()
24762476
object val
24772477
float64_t fval, fnan = np.nan

pandas/_libs/ops.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def scalar_binop(object[:] values, object val, object op) -> ndarray:
194194
"""
195195
cdef:
196196
Py_ssize_t i, n = len(values)
197-
object[:] result
197+
object[::1] result
198198
object x
199199

200200
result = np.empty(n, dtype=object)
@@ -231,7 +231,7 @@ def vec_binop(object[:] left, object[:] right, object op) -> ndarray:
231231
"""
232232
cdef:
233233
Py_ssize_t i, n = len(left)
234-
object[:] result
234+
object[::1] result
235235

236236
if n != <Py_ssize_t>len(right):
237237
raise ValueError(f'Arrays were different lengths: {n} vs {len(right)}')

0 commit comments

Comments
 (0)