Skip to content

Commit e4602a1

Browse files
authored
Merge branch 'main' into revert-cache-stacklevel
2 parents 942a3b9 + c671f6c commit e4602a1

35 files changed

+383
-234
lines changed

asv_bench/benchmarks/multiindex_object.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,11 @@ class SetOperations:
239239
("monotonic", "non_monotonic"),
240240
("datetime", "int", "string", "ea_int"),
241241
("intersection", "union", "symmetric_difference"),
242+
(False, None),
242243
]
243-
param_names = ["index_structure", "dtype", "method"]
244+
param_names = ["index_structure", "dtype", "method", "sort"]
244245

245-
def setup(self, index_structure, dtype, method):
246+
def setup(self, index_structure, dtype, method, sort):
246247
N = 10**5
247248
level1 = range(1000)
248249

@@ -272,8 +273,8 @@ def setup(self, index_structure, dtype, method):
272273
self.left = data[dtype]["left"]
273274
self.right = data[dtype]["right"]
274275

275-
def time_operation(self, index_structure, dtype, method):
276-
getattr(self.left, method)(self.right)
276+
def time_operation(self, index_structure, dtype, method, sort):
277+
getattr(self.left, method)(self.right, sort=sort)
277278

278279

279280
class Difference:

doc/redirects.csv

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ contributing_docstring,development/contributing_docstring
4545
developer,development/developer
4646
extending,development/extending
4747
internals,development/internals
48+
development/meeting,development/community
4849

4950
# api moved function
5051
reference/api/pandas.io.json.json_normalize,pandas.json_normalize

doc/source/development/community.rst

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
.. _community:
2+
3+
=====================
4+
Contributor community
5+
=====================
6+
7+
pandas is a community-driven open source project developed by a large group
8+
of `contributors <https://github.com/pandas-dev/pandas/graphs/contributors>`_
9+
and a smaller group of `maintainers <https://pandas.pydata.org/about/team.html>`_.
10+
The pandas leadership has made a strong commitment to creating an open,
11+
inclusive, and positive community. Please read the pandas `Code of Conduct
12+
<https://pandas.pydata.org/community/coc.html>`_ for guidance on how to
13+
interact with others in a way that makes the community thrive.
14+
15+
We offer several meetings and communication channels to share knowledge and
16+
connect with others within the pandas community.
17+
18+
Community meeting
19+
-----------------
20+
21+
The pandas Community Meeting is a regular sync meeting for the project's
22+
maintainers which is open to the community. Everyone is welcome to attend and
23+
contribute to conversations.
24+
25+
The meetings take place on the second Wednesday of each month at 18:00 UTC.
26+
27+
The minutes of past meetings are available in `this Google Document <https://docs.google.com/document/d/1tGbTiYORHiSPgVMXawiweGJlBw5dOkVJLY-licoBmBU/edit?usp=sharing>`__.
28+
29+
30+
New contributor meeting
31+
-----------------------
32+
33+
On the third Wednesday of the month, we hold meetings to welcome and support
34+
new contributors in our community.
35+
36+
| 👋 you all are invited
37+
| 💬 everyone can present (add yourself to the hackMD agenda)
38+
| 👀 anyone can sit in and listen
39+
40+
Attendees are new and experienced contributors, as well as a few maintainers.
41+
We aim to answer questions about getting started, or help with work in
42+
progress when possible, as well as get to know each other and share our
43+
learnings and experiences.
44+
45+
The agenda for the next meeting and minutes of past meetings are available in
46+
`this HackMD <https://hackmd.io/@pandas-dev/HJgQt1Tei>`__.
47+
48+
Calendar
49+
--------
50+
51+
This calendar shows all the community meetings. Our community meetings are
52+
ideal for anyone wanting to contribute to pandas, or just curious to know how
53+
current development is going.
54+
55+
.. raw:: html
56+
57+
<iframe src="https://calendar.google.com/calendar/embed?src=pgbn14p6poja8a1cf2dv2jhrmg%40group.calendar.google.com" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe>
58+
59+
You can subscribe to this calendar with the following links:
60+
61+
* `iCal <https://calendar.google.com/calendar/ical/pgbn14p6poja8a1cf2dv2jhrmg%40group.calendar.google.com/public/basic.ics>`__
62+
* `Google calendar <https://calendar.google.com/calendar/[email protected]>`__
63+
64+
Additionally, we'll sometimes have one-off meetings on specific topics.
65+
These will be published on the same calendar.
66+
67+
`GitHub issue tracker <https://github.com/pandas-dev/pandas/issues>`_
68+
----------------------------------------------------------------------
69+
70+
The pandas contributor community conducts conversations mainly via this channel.
71+
Any community member can open issues to:
72+
73+
- Report bugs, e.g. "I noticed the behavior of a certain function is
74+
incorrect"
75+
- Request features, e.g. "I would like this error message to be more readable"
76+
- Request documentation improvements, e.g. "I found this section unclear"
77+
- Ask questions, e.g. "I noticed the behavior of a certain function
78+
changed between versions. Is this expected?".
79+
80+
Ideally your questions should be related to how pandas work rather
81+
than how you use pandas. `StackOverflow <https://stackoverflow.com/>`_ is
82+
better suited for answering usage questions, and we ask that all usage
83+
questions are first asked on StackOverflow. Thank you for respecting are
84+
time and wishes. 🙇
85+
86+
Maintainers and frequent contributors might also open issues to discuss the
87+
ongoing development of the project. For example:
88+
89+
- Report issues with the CI, GitHub Actions, or the performance of pandas
90+
- Open issues relating to the internals
91+
- Start roadmap discussion aligning on proposals what to do in future
92+
releases or changes to the API.
93+
- Open issues relating to the project's website, logo, or governance
94+
95+
The developer mailing list
96+
--------------------------
97+
98+
The pandas mailing list `[email protected] <mailto://pandas-dev@python
99+
.org>`_ is used for long form
100+
conversations and to engages people in the wider community who might not
101+
be active on the issue tracker but we would like to include in discussions.
102+
103+
Community slack
104+
---------------
105+
106+
We have a chat platform for contributors, maintainers and potential
107+
contributors. This is not a space for user questions, rather for questions about
108+
contributing to pandas. The slack is a private space, specifically meant for
109+
people who are hesitant to bring up their questions or ideas on a large public
110+
mailing list or GitHub.
111+
112+
If this sounds like the right place for you, you are welcome to join! Email us
113+
at `[email protected] <mailto://[email protected]>`_ and let us
114+
know that you read and agree to our `Code of Conduct <https://pandas.pydata.org/community/coc.html>`_
115+
😉 to get an invite. And please remember the slack is not meant to replace the
116+
mailing list or issue tracker - all important announcements and conversations
117+
should still happen there.

doc/source/development/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ Development
2323
developer
2424
policies
2525
roadmap
26-
meeting
26+
community

doc/source/development/meeting.rst

-31
This file was deleted.

doc/source/whatsnew/index.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ This is the list of changes to pandas between each release. For full details,
1010
see the `commit logs <https://github.com/pandas-dev/pandas/commits/>`_. For install and
1111
upgrade instructions, see :ref:`install`.
1212

13-
Version 1.6
13+
Version 2.0
1414
-----------
1515

1616
.. toctree::
1717
:maxdepth: 2
1818

19-
v1.6.0
19+
v2.0.0
2020

2121
Version 1.5
2222
-----------

doc/source/whatsnew/v1.5.1.rst

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Fixed regressions
8585
- Fixed Regression in :meth:`DataFrameGroupBy.apply` when user defined function is called on an empty dataframe (:issue:`47985`)
8686
- Fixed regression in :meth:`DataFrame.apply` when passing non-zero ``axis`` via keyword argument (:issue:`48656`)
8787
- Fixed regression in :meth:`Series.groupby` and :meth:`DataFrame.groupby` when the grouper is a nullable data type (e.g. :class:`Int64`) or a PyArrow-backed string array, contains null values, and ``dropna=False`` (:issue:`48794`)
88+
- Fixed regression in :meth:`DataFrame.to_parquet` raising when file name was specified as ``bytes`` (:issue:`48944`)
8889
- Fixed regression in :class:`ExcelWriter` where the ``book`` attribute could no longer be set; however setting this attribute is now deprecated and this ability will be removed in a future version of pandas (:issue:`48780`)
8990
- Fixed regression causing memory leak when finding stacklevel when emitting warnings (:issue:`49052`)
9091

doc/source/whatsnew/v1.6.0.rst renamed to doc/source/whatsnew/v2.0.0.rst

+20-17
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
.. _whatsnew_160:
1+
.. _whatsnew_200:
22

3-
What's new in 1.6.0 (??)
3+
What's new in 2.0.0 (??)
44
------------------------
55

6-
These are the changes in pandas 1.6.0. See :ref:`release` for a full changelog
6+
These are the changes in pandas 2.0.0. See :ref:`release` for a full changelog
77
including other versions of pandas.
88

99
{{ header }}
1010

1111
.. ---------------------------------------------------------------------------
12-
.. _whatsnew_160.enhancements:
12+
.. _whatsnew_200.enhancements:
1313

1414
Enhancements
1515
~~~~~~~~~~~~
1616

17-
.. _whatsnew_160.enhancements.enhancement1:
17+
.. _whatsnew_200.enhancements.enhancement1:
1818

1919
enhancement1
2020
^^^^^^^^^^^^
2121

22-
.. _whatsnew_160.enhancements.enhancement2:
22+
.. _whatsnew_200.enhancements.enhancement2:
2323

2424
enhancement2
2525
^^^^^^^^^^^^
2626

27-
.. _whatsnew_160.enhancements.other:
27+
.. _whatsnew_200.enhancements.other:
2828

2929
Other enhancements
3030
^^^^^^^^^^^^^^^^^^
@@ -39,14 +39,14 @@ Other enhancements
3939
-
4040

4141
.. ---------------------------------------------------------------------------
42-
.. _whatsnew_160.notable_bug_fixes:
42+
.. _whatsnew_200.notable_bug_fixes:
4343

4444
Notable bug fixes
4545
~~~~~~~~~~~~~~~~~
4646

4747
These are bug fixes that might have notable behavior changes.
4848

49-
.. _whatsnew_160.notable_bug_fixes.notable_bug_fix1:
49+
.. _whatsnew_200.notable_bug_fixes.notable_bug_fix1:
5050

5151
:meth:`.GroupBy.cumsum` and :meth:`.GroupBy.cumprod` overflow instead of lossy casting to float
5252
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -76,18 +76,18 @@ We return incorrect results with the 6th value.
7676
7777
We overflow with the 7th value, but the 6th value is still correct.
7878

79-
.. _whatsnew_160.notable_bug_fixes.notable_bug_fix2:
79+
.. _whatsnew_200.notable_bug_fixes.notable_bug_fix2:
8080

8181
notable_bug_fix2
8282
^^^^^^^^^^^^^^^^
8383

8484
.. ---------------------------------------------------------------------------
85-
.. _whatsnew_160.api_breaking:
85+
.. _whatsnew_200.api_breaking:
8686

8787
Backwards incompatible API changes
8888
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8989

90-
.. _whatsnew_160.api_breaking.deps:
90+
.. _whatsnew_200.api_breaking.deps:
9191

9292
Increased minimum versions for dependencies
9393
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -112,7 +112,7 @@ Optional libraries below the lowest tested version may still work, but are not c
112112

113113
See :ref:`install.dependencies` and :ref:`install.optional_dependencies` for more.
114114

115-
.. _whatsnew_160.api_breaking.other:
115+
.. _whatsnew_200.api_breaking.other:
116116

117117
Other API changes
118118
^^^^^^^^^^^^^^^^^
@@ -121,18 +121,19 @@ Other API changes
121121
- Default value of ``dtype`` in :func:`get_dummies` is changed to ``bool`` from ``uint8`` (:issue:`45848`)
122122
- :meth:`DataFrame.astype`, :meth:`Series.astype`, and :meth:`DatetimeIndex.astype` casting datetime64 data to any of "datetime64[s]", "datetime64[ms]", "datetime64[us]" will return an object with the given resolution instead of coercing back to "datetime64[ns]" (:issue:`48928`)
123123
- :meth:`DataFrame.astype`, :meth:`Series.astype`, and :meth:`DatetimeIndex.astype` casting timedelta64 data to any of "timedelta64[s]", "timedelta64[ms]", "timedelta64[us]" will return an object with the given resolution instead of coercing to "float64" dtype (:issue:`48963`)
124+
- Passing a ``np.datetime64`` object with non-nanosecond resolution to :class:`Timestamp` will retain the input resolution if it is "s", "ms", or "ns"; otherwise it will be cast to the closest supported resolution (:issue:`49008`)
124125
-
125126

126127
.. ---------------------------------------------------------------------------
127-
.. _whatsnew_160.deprecations:
128+
.. _whatsnew_200.deprecations:
128129

129130
Deprecations
130131
~~~~~~~~~~~~
131132
-
132133
-
133134

134135
.. ---------------------------------------------------------------------------
135-
.. _whatsnew_160.performance:
136+
.. _whatsnew_200.performance:
136137

137138
Performance improvements
138139
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -141,6 +142,7 @@ Performance improvements
141142
- Performance improvement in :meth:`MultiIndex.size` (:issue:`48723`)
142143
- Performance improvement in :meth:`MultiIndex.union` without missing values and without duplicates (:issue:`48505`)
143144
- Performance improvement in :meth:`MultiIndex.difference` (:issue:`48606`)
145+
- Performance improvement in :class:`MultiIndex` set operations with sort=None (:issue:`49010`)
144146
- Performance improvement in :meth:`.DataFrameGroupBy.mean`, :meth:`.SeriesGroupBy.mean`, :meth:`.DataFrameGroupBy.var`, and :meth:`.SeriesGroupBy.var` for extension array dtypes (:issue:`37493`)
145147
- Performance improvement in :meth:`MultiIndex.isin` when ``level=None`` (:issue:`48622`)
146148
- Performance improvement in :meth:`Index.union` and :meth:`MultiIndex.union` when index contains duplicates (:issue:`48900`)
@@ -158,7 +160,7 @@ Performance improvements
158160
- Performance improvement in :class:`DataFrameGroupBy` and :class:`SeriesGroupBy` when ``by`` is a categorical type and ``sort=False`` (:issue:`48976`)
159161

160162
.. ---------------------------------------------------------------------------
161-
.. _whatsnew_160.bug_fixes:
163+
.. _whatsnew_200.bug_fixes:
162164

163165
Bug fixes
164166
~~~~~~~~~
@@ -230,6 +232,7 @@ MultiIndex
230232
- Bug in :meth:`MultiIndex.unique` losing extension array dtype (:issue:`48335`)
231233
- Bug in :meth:`MultiIndex.intersection` losing extension array (:issue:`48604`)
232234
- Bug in :meth:`MultiIndex.union` losing extension array (:issue:`48498`, :issue:`48505`, :issue:`48900`)
235+
- Bug in :meth:`MultiIndex.union` not sorting when sort=None and index contains missing values (:issue:`49010`)
233236
- Bug in :meth:`MultiIndex.append` not checking names for equality (:issue:`48288`)
234237
- Bug in :meth:`MultiIndex.symmetric_difference` losing extension array (:issue:`48607`)
235238
-
@@ -294,7 +297,7 @@ Other
294297
-
295298

296299
.. ---------------------------------------------------------------------------
297-
.. _whatsnew_160.contributors:
300+
.. _whatsnew_200.contributors:
298301

299302
Contributors
300303
~~~~~~~~~~~~

pandas/_libs/tslib.pyx

+3-1
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ cpdef array_to_datetime(
513513
found_tz = True
514514
if utc_convert:
515515
_ts = convert_datetime_to_tsobject(val, None)
516+
_ts.ensure_reso(NPY_FR_ns)
516517
iresult[i] = _ts.value
517518
elif found_naive:
518519
raise ValueError('Tz-aware datetime.datetime '
@@ -526,6 +527,7 @@ cpdef array_to_datetime(
526527
found_tz = True
527528
tz_out = val.tzinfo
528529
_ts = convert_datetime_to_tsobject(val, None)
530+
_ts.ensure_reso(NPY_FR_ns)
529531
iresult[i] = _ts.value
530532

531533
else:
@@ -534,7 +536,7 @@ cpdef array_to_datetime(
534536
raise ValueError('Cannot mix tz-aware with '
535537
'tz-naive values')
536538
if isinstance(val, _Timestamp):
537-
iresult[i] = val.value
539+
iresult[i] = val._as_unit("ns").value
538540
else:
539541
iresult[i] = pydatetime_to_dt64(val, &dts)
540542
check_dts_bounds(&dts)

pandas/_libs/tslibs/conversion.pxd

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ cdef class _TSObject:
2020
int64_t value # numpy dt64
2121
tzinfo tzinfo
2222
bint fold
23+
NPY_DATETIMEUNIT reso
24+
25+
cdef void ensure_reso(self, NPY_DATETIMEUNIT reso)
2326

2427

2528
cdef _TSObject convert_to_tsobject(object ts, tzinfo tz, str unit,

0 commit comments

Comments
 (0)