Skip to content

Commit b2b2540

Browse files
committed
Merge branch 'main' into bug-expansion-dtypes
2 parents 46362d9 + 012166c commit b2b2540

File tree

24 files changed

+352
-225
lines changed

24 files changed

+352
-225
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,7 @@ Other Deprecations
716716
- Deprecated using ``epoch`` date format in :meth:`DataFrame.to_json` and :meth:`Series.to_json`, use ``iso`` instead. (:issue:`57063`)
717717
- Deprecated allowing ``fill_value`` that cannot be held in the original dtype (excepting NA values for integer and bool dtypes) in :meth:`Series.unstack` and :meth:`DataFrame.unstack` (:issue:`12189`, :issue:`53868`)
718718
- Deprecated allowing ``fill_value`` that cannot be held in the original dtype (excepting NA values for integer and bool dtypes) in :meth:`Series.shift` and :meth:`DataFrame.shift` (:issue:`53802`)
719+
- Deprecated option "future.no_silent_downcasting", as it is no longer used. In a future version accessing this option will raise (:issue:`59502`)
719720
- Deprecated slicing on a :class:`Series` or :class:`DataFrame` with a :class:`DatetimeIndex` using a ``datetime.date`` object, explicitly cast to :class:`Timestamp` instead (:issue:`35830`)
720721

721722
.. ---------------------------------------------------------------------------
@@ -1012,12 +1013,13 @@ Strings
10121013
^^^^^^^
10131014
- Bug in :meth:`Series.str.zfill` raising ``AttributeError`` for :class:`ArrowDtype` (:issue:`61485`)
10141015
- Bug in :meth:`Series.value_counts` would not respect ``sort=False`` for series having ``string`` dtype (:issue:`55224`)
1016+
- Bug in multiplication with a :class:`StringDtype` incorrectly allowing multiplying by bools; explicitly cast to integers instead (:issue:`62595`)
10151017

10161018
Interval
10171019
^^^^^^^^
10181020
- :meth:`Index.is_monotonic_decreasing`, :meth:`Index.is_monotonic_increasing`, and :meth:`Index.is_unique` could incorrectly be ``False`` for an ``Index`` created from a slice of another ``Index``. (:issue:`57911`)
1021+
- Bug in :class:`Index`, :class:`Series`, :class:`DataFrame` constructors when given a sequence of :class:`Interval` subclass objects casting them to :class:`Interval` (:issue:`46945`)
10191022
- Bug in :func:`interval_range` where start and end numeric types were always cast to 64 bit (:issue:`57268`)
1020-
-
10211023

10221024
Indexing
10231025
^^^^^^^^

pandas/_libs/include/pandas/parser/pd_parser.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ typedef struct {
3737
int (*parser_trim_buffers)(parser_t *);
3838
int (*tokenize_all_rows)(parser_t *, const char *);
3939
int (*tokenize_nrows)(parser_t *, size_t, const char *);
40-
int64_t (*str_to_int64)(const char *, int64_t, int64_t, int *, char);
41-
uint64_t (*str_to_uint64)(uint_state *, const char *, int64_t, uint64_t,
42-
int *, char);
40+
int64_t (*str_to_int64)(const char *, int *, char);
41+
uint64_t (*str_to_uint64)(uint_state *, const char *, int *, char);
4342
double (*xstrtod)(const char *, char **, char, char, char, int, int *, int *);
4443
double (*precise_xstrtod)(const char *, char **, char, char, char, int, int *,
4544
int *);
@@ -87,12 +86,10 @@ static PandasParser_CAPI *PandasParserAPI = NULL;
8786
PandasParserAPI->tokenize_all_rows((self), (encoding_errors))
8887
#define tokenize_nrows(self, nrows, encoding_errors) \
8988
PandasParserAPI->tokenize_nrows((self), (nrows), (encoding_errors))
90-
#define str_to_int64(p_item, int_min, int_max, error, t_sep) \
91-
PandasParserAPI->str_to_int64((p_item), (int_min), (int_max), (error), \
92-
(t_sep))
93-
#define str_to_uint64(state, p_item, int_max, uint_max, error, t_sep) \
94-
PandasParserAPI->str_to_uint64((state), (p_item), (int_max), (uint_max), \
95-
(error), (t_sep))
89+
#define str_to_int64(p_item, error, t_sep) \
90+
PandasParserAPI->str_to_int64((p_item), (error), (t_sep))
91+
#define str_to_uint64(state, p_item, error, t_sep) \
92+
PandasParserAPI->str_to_uint64((state), (p_item), (error), (t_sep))
9693
#define xstrtod(p, q, decimal, sci, tsep, skip_trailing, error, maybe_int) \
9794
PandasParserAPI->xstrtod((p), (q), (decimal), (sci), (tsep), \
9895
(skip_trailing), (error), (maybe_int))

pandas/_libs/include/pandas/parser/tokenizer.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,9 @@ void uint_state_init(uint_state *self);
208208

209209
int uint64_conflict(uint_state *self);
210210

211-
uint64_t str_to_uint64(uint_state *state, const char *p_item, int64_t int_max,
212-
uint64_t uint_max, int *error, char tsep);
213-
int64_t str_to_int64(const char *p_item, int64_t int_min, int64_t int_max,
214-
int *error, char tsep);
211+
uint64_t str_to_uint64(uint_state *state, const char *p_item, int *error,
212+
char tsep);
213+
int64_t str_to_int64(const char *p_item, int *error, char tsep);
215214
double xstrtod(const char *p, char **q, char decimal, char sci, char tsep,
216215
int skip_trailing, int *error, int *maybe_int);
217216
double precise_xstrtod(const char *p, char **q, char decimal, char sci,

pandas/_libs/lib.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2255,7 +2255,8 @@ cpdef bint is_interval_array(ndarray values):
22552255
for i in range(n):
22562256
val = values[i]
22572257

2258-
if isinstance(val, Interval):
2258+
if type(val) is Interval:
2259+
# GH#46945 catch Interval exactly, excluding subclasses
22592260
if closed is None:
22602261
closed = val.closed
22612262
numeric = (

pandas/_libs/parsers.pyx

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ from numpy cimport (
6363
cnp.import_array()
6464

6565
from pandas._libs cimport util
66-
from pandas._libs.util cimport (
67-
INT64_MAX,
68-
INT64_MIN,
69-
UINT64_MAX,
70-
)
7166

7267
from pandas._libs import lib
7368

@@ -281,10 +276,8 @@ cdef extern from "pandas/parser/pd_parser.h":
281276
int tokenize_all_rows(parser_t *self, const char *encoding_errors) nogil
282277
int tokenize_nrows(parser_t *self, size_t nrows, const char *encoding_errors) nogil
283278

284-
int64_t str_to_int64(char *p_item, int64_t int_min,
285-
int64_t int_max, int *error, char tsep) nogil
286-
uint64_t str_to_uint64(uint_state *state, char *p_item, int64_t int_max,
287-
uint64_t uint_max, int *error, char tsep) nogil
279+
int64_t str_to_int64(char *p_item, int *error, char tsep) nogil
280+
uint64_t str_to_uint64(uint_state *state, char *p_item, int *error, char tsep) nogil
288281

289282
double xstrtod(const char *p, char **q, char decimal,
290283
char sci, char tsep, int skip_trailing,
@@ -1855,15 +1848,13 @@ cdef int _try_uint64_nogil(parser_t *parser, int64_t col,
18551848
data[i] = 0
18561849
continue
18571850

1858-
data[i] = str_to_uint64(state, word, INT64_MAX, UINT64_MAX,
1859-
&error, parser.thousands)
1851+
data[i] = str_to_uint64(state, word, &error, parser.thousands)
18601852
if error != 0:
18611853
return error
18621854
else:
18631855
for i in range(lines):
18641856
COLITER_NEXT(it, word)
1865-
data[i] = str_to_uint64(state, word, INT64_MAX, UINT64_MAX,
1866-
&error, parser.thousands)
1857+
data[i] = str_to_uint64(state, word, &error, parser.thousands)
18671858
if error != 0:
18681859
return error
18691860

@@ -1920,15 +1911,13 @@ cdef int _try_int64_nogil(parser_t *parser, int64_t col,
19201911
data[i] = NA
19211912
continue
19221913

1923-
data[i] = str_to_int64(word, INT64_MIN, INT64_MAX,
1924-
&error, parser.thousands)
1914+
data[i] = str_to_int64(word, &error, parser.thousands)
19251915
if error != 0:
19261916
return error
19271917
else:
19281918
for i in range(lines):
19291919
COLITER_NEXT(it, word)
1930-
data[i] = str_to_int64(word, INT64_MIN, INT64_MAX,
1931-
&error, parser.thousands)
1920+
data[i] = str_to_int64(word, &error, parser.thousands)
19321921
if error != 0:
19331922
return error
19341923

0 commit comments

Comments
 (0)