Skip to content

Commit d4a3a4d

Browse files
committed
Merge remote-tracking branch 'upstream/main' into examplesMay31
2 parents c7d3498 + a1f050a commit d4a3a4d

Some content is hidden

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

56 files changed

+581
-341
lines changed

.circleci/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ jobs:
2626
image: ubuntu-2004:2022.04.1
2727
resource_class: arm.large
2828
environment:
29-
ENV_FILE: ci/deps/circle-38-arm64.yaml
3029
TRIGGER_SOURCE: << pipeline.trigger_source >>
3130
steps:
3231
- checkout

.github/workflows/wheels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
fetch-depth: 0
7474

7575
- name: Build wheels
76-
uses: pypa/cibuildwheel@v2.12.3
76+
uses: pypa/cibuildwheel@v2.13.0
7777
env:
7878
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
7979

ci/code_checks.sh

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -258,17 +258,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
258258
pandas.IntervalIndex.to_tuples \
259259
pandas.MultiIndex.dtypes \
260260
pandas.MultiIndex.drop \
261-
pandas.DatetimeIndex \
262-
pandas.DatetimeIndex.date \
263-
pandas.DatetimeIndex.time \
264-
pandas.DatetimeIndex.timetz \
265-
pandas.DatetimeIndex.dayofyear \
266-
pandas.DatetimeIndex.day_of_year \
267-
pandas.DatetimeIndex.quarter \
268-
pandas.DatetimeIndex.tz \
269-
pandas.DatetimeIndex.freqstr \
270-
pandas.DatetimeIndex.inferred_freq \
271-
pandas.DatetimeIndex.indexer_at_time \
272261
pandas.DatetimeIndex.indexer_between_time \
273262
pandas.DatetimeIndex.snap \
274263
pandas.DatetimeIndex.as_unit \
@@ -277,7 +266,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
277266
pandas.DatetimeIndex.mean \
278267
pandas.DatetimeIndex.std \
279268
pandas.TimedeltaIndex \
280-
pandas.TimedeltaIndex.days \
281269
pandas.TimedeltaIndex.seconds \
282270
pandas.TimedeltaIndex.microseconds \
283271
pandas.TimedeltaIndex.nanoseconds \

doc/source/development/contributing_codebase.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ install pandas) by typing::
770770
your installation is probably fine and you can start contributing!
771771

772772
Often it is worth running only a subset of tests first around your changes before running the
773-
entire suite (tip: you can use the [pandas-coverage app](https://pandas-coverage.herokuapp.com/)
773+
entire suite (tip: you can use the [pandas-coverage app](https://pandas-coverage.herokuapp.com/))
774774
to find out which tests hit the lines of code you've modified, and then run only those).
775775

776776
The easiest way to do this is with::

doc/source/getting_started/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Installation
2424

2525
.. code-block:: bash
2626
27-
conda install pandas
27+
conda install -c conda-forge pandas
2828
2929
.. grid-item-card:: Prefer pip?
3030
:class-card: install-card

doc/source/getting_started/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ Installable with ``pip install "pandas[performance]"``
295295
===================================================== ================== ================== ===================================================================================================================================================================================
296296
Dependency Minimum Version pip extra Notes
297297
===================================================== ================== ================== ===================================================================================================================================================================================
298-
`numexpr <https://github.com/pydata/numexpr>`__ 2.8.0 performance Accelerates certain numerical operations by using uses multiple cores as well as smart chunking and caching to achieve large speedups
298+
`numexpr <https://github.com/pydata/numexpr>`__ 2.8.0 performance Accelerates certain numerical operations by using multiple cores as well as smart chunking and caching to achieve large speedups
299299
`bottleneck <https://github.com/pydata/bottleneck>`__ 1.3.4 performance Accelerates certain types of ``nan`` by using specialized cython routines to achieve large speedup.
300300
`numba <https://github.com/numba/numba>`__ 0.55.2 performance Alternative execution engine for operations that accept ``engine="numba"`` using a JIT compiler that translates Python functions to optimized machine code using the LLVM compiler.
301301
===================================================== ================== ================== ===================================================================================================================================================================================

doc/source/user_guide/basics.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2128,7 +2128,7 @@ different numeric dtypes will **NOT** be combined. The following example will gi
21282128
{
21292129
"A": pd.Series(np.random.randn(8), dtype="float16"),
21302130
"B": pd.Series(np.random.randn(8)),
2131-
"C": pd.Series(np.array(np.random.randn(8), dtype="uint8")),
2131+
"C": pd.Series(np.random.randint(0, 255, size=8), dtype="uint8"), # [0,255] (range of uint8)
21322132
}
21332133
)
21342134
df2

doc/source/whatsnew/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Version 2.0
2424
.. toctree::
2525
:maxdepth: 2
2626

27+
v2.0.3
2728
v2.0.2
2829
v2.0.1
2930
v2.0.0

doc/source/whatsnew/v2.0.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1413,4 +1413,4 @@ Other
14131413
Contributors
14141414
~~~~~~~~~~~~
14151415

1416-
.. contributors:: v1.5.0rc0..v2.0.0|HEAD
1416+
.. contributors:: v1.5.0rc0..v2.0.0

doc/source/whatsnew/v2.0.1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ Other
6565
Contributors
6666
~~~~~~~~~~~~
6767

68-
.. contributors:: v2.0.0..v2.0.1|HEAD
68+
.. contributors:: v2.0.0..v2.0.1

doc/source/whatsnew/v2.0.2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ Other
5454
Contributors
5555
~~~~~~~~~~~~
5656

57-
.. contributors:: v2.0.1..v2.0.2|HEAD
57+
.. contributors:: v2.0.1..v2.0.2

doc/source/whatsnew/v2.0.3.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.. _whatsnew_203:
2+
3+
What's new in 2.0.3 (July XX, 2023)
4+
-----------------------------------
5+
6+
These are the changes in pandas 2.0.3. See :ref:`release` for a full changelog
7+
including other versions of pandas.
8+
9+
{{ header }}
10+
11+
.. ---------------------------------------------------------------------------
12+
.. _whatsnew_203.regressions:
13+
14+
Fixed regressions
15+
~~~~~~~~~~~~~~~~~
16+
-
17+
18+
.. ---------------------------------------------------------------------------
19+
.. _whatsnew_203.bug_fixes:
20+
21+
Bug fixes
22+
~~~~~~~~~
23+
-
24+
25+
.. ---------------------------------------------------------------------------
26+
.. _whatsnew_203.other:
27+
28+
Other
29+
~~~~~
30+
-
31+
32+
.. ---------------------------------------------------------------------------
33+
.. _whatsnew_203.contributors:
34+
35+
Contributors
36+
~~~~~~~~~~~~
37+
38+
.. contributors:: v2.0.2..v2.0.3|HEAD

doc/source/whatsnew/v2.1.0.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ Other enhancements
9797
- Let :meth:`DataFrame.to_feather` accept a non-default :class:`Index` and non-string column names (:issue:`51787`)
9898
- Performance improvement in :func:`read_csv` (:issue:`52632`) with ``engine="c"``
9999
- :meth:`Categorical.from_codes` has gotten a ``validate`` parameter (:issue:`50975`)
100+
- :meth:`DataFrame.stack` gained the ``sort`` keyword to dictate whether the resulting :class:`MultiIndex` levels are sorted (:issue:`15105`)
100101
- Added ``engine_kwargs`` parameter to :meth:`DataFrame.to_excel` (:issue:`53220`)
101102
- Performance improvement in :func:`concat` with homogeneous ``np.float64`` or ``np.float32`` dtypes (:issue:`52685`)
102103
- Performance improvement in :meth:`DataFrame.filter` when ``items`` is given (:issue:`52941`)
@@ -251,6 +252,7 @@ Deprecations
251252
- Deprecated :meth:`DataFrame.applymap`. Use the new :meth:`DataFrame.map` method instead (:issue:`52353`)
252253
- Deprecated :meth:`DataFrame.swapaxes` and :meth:`Series.swapaxes`, use :meth:`DataFrame.transpose` or :meth:`Series.transpose` instead (:issue:`51946`)
253254
- Deprecated ``freq`` parameter in :class:`PeriodArray` constructor, pass ``dtype`` instead (:issue:`52462`)
255+
- Deprecated allowing non-standard inputs in :func:`take`, pass either a ``numpy.ndarray``, :class:`ExtensionArray`, :class:`Index`, or :class:`Series` (:issue:`52981`)
254256
- Deprecated behavior of :class:`DataFrame` reductions ``sum``, ``prod``, ``std``, ``var``, ``sem`` with ``axis=None``, in a future version this will operate over both axes returning a scalar instead of behaving like ``axis=0``; note this also affects numpy functions e.g. ``np.sum(df)`` (:issue:`21597`)
255257
- Deprecated behavior of :func:`concat` when :class:`DataFrame` has columns that are all-NA, in a future version these will not be discarded when determining the resulting dtype (:issue:`40893`)
256258
- Deprecated behavior of :meth:`Series.dt.to_pydatetime`, in a future version this will return a :class:`Series` containing python ``datetime`` objects instead of an ``ndarray`` of datetimes; this matches the behavior of other :meth:`Series.dt` properties (:issue:`20306`)
@@ -351,6 +353,7 @@ Numeric
351353
- Bug in :meth:`Series.any`, :meth:`Series.all`, :meth:`DataFrame.any`, and :meth:`DataFrame.all` had the default value of ``bool_only`` set to ``None`` instead of ``False``; this change should have no impact on users (:issue:`53258`)
352354
- Bug in :meth:`Series.corr` and :meth:`Series.cov` raising ``AttributeError`` for masked dtypes (:issue:`51422`)
353355
- Bug in :meth:`Series.median` and :meth:`DataFrame.median` with object-dtype values containing strings that can be converted to numbers (e.g. "2") returning incorrect numeric results; these now raise ``TypeError`` (:issue:`34671`)
356+
- Bug in :meth:`Series.sum` converting dtype ``uint64`` to ``int64`` (:issue:`53401`)
354357

355358

356359
Conversion
@@ -396,6 +399,7 @@ I/O
396399
- :meth:`DataFrame.to_sql` now raising ``ValueError`` when the name param is left empty while using SQLAlchemy to connect (:issue:`52675`)
397400
- Bug in :func:`json_normalize`, fix json_normalize cannot parse metadata fields list type (:issue:`37782`)
398401
- Bug in :func:`read_csv` where it would error when ``parse_dates`` was set to a list or dictionary with ``engine="pyarrow"`` (:issue:`47961`)
402+
- Bug in :func:`read_csv`, with ``engine="pyarrow"`` erroring when specifying a ``dtype`` with ``index_col`` (:issue:`53229`)
399403
- Bug in :func:`read_hdf` not properly closing store after a ``IndexError`` is raised (:issue:`52781`)
400404
- Bug in :func:`read_html`, style elements were read into DataFrames (:issue:`52197`)
401405
- Bug in :func:`read_html`, tail texts were removed together with elements containing ``display:none`` style (:issue:`51629`)

pandas/_libs/algos.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from pandas._libs.dtypes cimport (
44
)
55

66

7-
cdef numeric_t kth_smallest_c(numeric_t* arr, Py_ssize_t k, Py_ssize_t n) nogil
7+
cdef numeric_t kth_smallest_c(numeric_t* arr, Py_ssize_t k, Py_ssize_t n) noexcept nogil
88

99
cdef enum TiebreakEnumType:
1010
TIEBREAK_AVERAGE

pandas/_libs/algos.pyx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def groupsort_indexer(const intp_t[:] index, Py_ssize_t ngroups):
259259
return indexer.base, counts.base
260260

261261

262-
cdef Py_ssize_t swap(numeric_t *a, numeric_t *b) nogil:
262+
cdef Py_ssize_t swap(numeric_t *a, numeric_t *b) noexcept nogil:
263263
cdef:
264264
numeric_t t
265265

@@ -270,7 +270,8 @@ cdef Py_ssize_t swap(numeric_t *a, numeric_t *b) nogil:
270270
return 0
271271

272272

273-
cdef numeric_t kth_smallest_c(numeric_t* arr, Py_ssize_t k, Py_ssize_t n) nogil:
273+
cdef numeric_t kth_smallest_c(numeric_t* arr,
274+
Py_ssize_t k, Py_ssize_t n) noexcept nogil:
274275
"""
275276
See kth_smallest.__doc__. The additional parameter n specifies the maximum
276277
number of elements considered in arr, needed for compatibility with usage
@@ -1062,7 +1063,7 @@ cdef void rank_sorted_1d(
10621063
# https://github.com/cython/cython/issues/1630, only trailing arguments can
10631064
# currently be omitted for cdef functions, which is why we keep this at the end
10641065
const intp_t[:] labels=None,
1065-
) nogil:
1066+
) noexcept nogil:
10661067
"""
10671068
See rank_1d.__doc__. Handles only actual ranking, so sorting and masking should
10681069
be handled in the caller. Note that `out` and `grp_sizes` are modified inplace.

pandas/_libs/groupby.pyx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ cdef enum InterpolationEnumType:
6262
INTERPOLATION_MIDPOINT
6363

6464

65-
cdef float64_t median_linear_mask(float64_t* a, int n, uint8_t* mask) nogil:
65+
cdef float64_t median_linear_mask(float64_t* a, int n, uint8_t* mask) noexcept nogil:
6666
cdef:
6767
int i, j, na_count = 0
6868
float64_t* tmp
@@ -99,7 +99,7 @@ cdef float64_t median_linear_mask(float64_t* a, int n, uint8_t* mask) nogil:
9999
return result
100100

101101

102-
cdef float64_t median_linear(float64_t* a, int n) nogil:
102+
cdef float64_t median_linear(float64_t* a, int n) noexcept nogil:
103103
cdef:
104104
int i, j, na_count = 0
105105
float64_t* tmp
@@ -136,7 +136,7 @@ cdef float64_t median_linear(float64_t* a, int n) nogil:
136136
return result
137137

138138

139-
cdef float64_t calc_median_linear(float64_t* a, int n, int na_count) nogil:
139+
cdef float64_t calc_median_linear(float64_t* a, int n, int na_count) noexcept nogil:
140140
cdef:
141141
float64_t result
142142

@@ -1300,7 +1300,8 @@ ctypedef fused numeric_object_complex_t:
13001300
complex128_t
13011301

13021302

1303-
cdef bint _treat_as_na(numeric_object_complex_t val, bint is_datetimelike) nogil:
1303+
cdef bint _treat_as_na(numeric_object_complex_t val,
1304+
bint is_datetimelike) noexcept nogil:
13041305
if numeric_object_complex_t is object:
13051306
# Should never be used, but we need to avoid the `val != val` below
13061307
# or else cython will raise about gil acquisition.

pandas/_libs/hashing.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ def hash_object_array(
110110
return result.base # .base to retrieve underlying np.ndarray
111111

112112

113-
cdef uint64_t _rotl(uint64_t x, uint64_t b) nogil:
113+
cdef uint64_t _rotl(uint64_t x, uint64_t b) noexcept nogil:
114114
return (x << b) | (x >> (64 - b))
115115

116116

117-
cdef uint64_t u8to64_le(uint8_t* p) nogil:
117+
cdef uint64_t u8to64_le(uint8_t* p) noexcept nogil:
118118
return (<uint64_t>p[0] |
119119
<uint64_t>p[1] << 8 |
120120
<uint64_t>p[2] << 16 |
@@ -145,7 +145,7 @@ cdef void _sipround(uint64_t* v0, uint64_t* v1,
145145

146146
@cython.cdivision(True)
147147
cdef uint64_t low_level_siphash(uint8_t* data, size_t datalen,
148-
uint8_t* key) nogil:
148+
uint8_t* key) noexcept nogil:
149149
cdef uint64_t v0 = 0x736f6d6570736575ULL
150150
cdef uint64_t v1 = 0x646f72616e646f6dULL
151151
cdef uint64_t v2 = 0x6c7967656e657261ULL

pandas/_libs/hashtable_class_helper.pxi.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ complex_types = ['complex64',
1313
}}
1414

1515
{{for name in complex_types}}
16-
cdef kh{{name}}_t to_kh{{name}}_t({{name}}_t val) nogil:
16+
cdef kh{{name}}_t to_kh{{name}}_t({{name}}_t val) noexcept nogil:
1717
cdef kh{{name}}_t res
1818
res.real = val.real
1919
res.imag = val.imag
@@ -42,7 +42,7 @@ c_types = ['khcomplex128_t',
4242

4343
{{for c_type in c_types}}
4444

45-
cdef bint is_nan_{{c_type}}({{c_type}} val) nogil:
45+
cdef bint is_nan_{{c_type}}({{c_type}} val) noexcept nogil:
4646
{{if c_type in {'khcomplex128_t', 'khcomplex64_t'} }}
4747
return val.real != val.real or val.imag != val.imag
4848
{{elif c_type in {'float64_t', 'float32_t'} }}
@@ -55,7 +55,7 @@ cdef bint is_nan_{{c_type}}({{c_type}} val) nogil:
5555
{{if c_type in {'khcomplex128_t', 'khcomplex64_t', 'float64_t', 'float32_t'} }}
5656
# are_equivalent_{{c_type}} is cimported via khash.pxd
5757
{{else}}
58-
cdef bint are_equivalent_{{c_type}}({{c_type}} val1, {{c_type}} val2) nogil:
58+
cdef bint are_equivalent_{{c_type}}({{c_type}} val1, {{c_type}} val2) noexcept nogil:
5959
return val1 == val2
6060
{{endif}}
6161

@@ -163,7 +163,7 @@ ctypedef fused vector_data:
163163
Complex64VectorData
164164
StringVectorData
165165

166-
cdef bint needs_resize(vector_data *data) nogil:
166+
cdef bint needs_resize(vector_data *data) noexcept nogil:
167167
return data.n == data.m
168168

169169
# ----------------------------------------------------------------------

pandas/_libs/lib.pyx

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,9 +1192,12 @@ _TYPE_MAP = {
11921192
"u": "integer",
11931193
"float32": "floating",
11941194
"float64": "floating",
1195+
"float128": "floating",
1196+
"float256": "floating",
11951197
"f": "floating",
11961198
"complex64": "complex",
11971199
"complex128": "complex",
1200+
"complex256": "complex",
11981201
"c": "complex",
11991202
"string": "string",
12001203
str: "string",
@@ -1216,23 +1219,6 @@ _TYPE_MAP = {
12161219
bytes: "bytes",
12171220
}
12181221

1219-
# types only exist on certain platform
1220-
try:
1221-
np.float128
1222-
_TYPE_MAP["float128"] = "floating"
1223-
except AttributeError:
1224-
pass
1225-
try:
1226-
np.complex256
1227-
_TYPE_MAP["complex256"] = "complex"
1228-
except AttributeError:
1229-
pass
1230-
try:
1231-
np.float16
1232-
_TYPE_MAP["float16"] = "floating"
1233-
except AttributeError:
1234-
pass
1235-
12361222

12371223
@cython.internal
12381224
cdef class Seen:

pandas/_libs/tslibs/ccalendar.pxd

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ from numpy cimport (
66

77
ctypedef (int32_t, int32_t, int32_t) iso_calendar_t
88

9-
cdef int dayofweek(int y, int m, int d) nogil
10-
cdef bint is_leapyear(int64_t year) nogil
11-
cpdef int32_t get_days_in_month(int year, Py_ssize_t month) nogil
12-
cpdef int32_t get_week_of_year(int year, int month, int day) nogil
13-
cpdef iso_calendar_t get_iso_calendar(int year, int month, int day) nogil
14-
cpdef int32_t get_day_of_year(int year, int month, int day) nogil
15-
cpdef int get_lastbday(int year, int month) nogil
16-
cpdef int get_firstbday(int year, int month) nogil
9+
cdef int dayofweek(int y, int m, int d) noexcept nogil
10+
cdef bint is_leapyear(int64_t year) noexcept nogil
11+
cpdef int32_t get_days_in_month(int year, Py_ssize_t month) noexcept nogil
12+
cpdef int32_t get_week_of_year(int year, int month, int day) noexcept nogil
13+
cpdef iso_calendar_t get_iso_calendar(int year, int month, int day) noexcept nogil
14+
cpdef int32_t get_day_of_year(int year, int month, int day) noexcept nogil
15+
cpdef int get_lastbday(int year, int month) noexcept nogil
16+
cpdef int get_firstbday(int year, int month) noexcept nogil
1717

1818
cdef dict c_MONTH_NUMBERS
1919

0 commit comments

Comments
 (0)