Skip to content

Commit 75a181b

Browse files
authored
Merge branch 'main' into enforce-match
2 parents b700b71 + 2a9855b commit 75a181b

File tree

106 files changed

+1785
-1701
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

+1785
-1701
lines changed

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ jobs:
391391
env:
392392
PYTHON_GIL: 0
393393

394+
# NOTE: this job must be kept in sync with the Pyodide build job in wheels.yml
394395
emscripten:
395396
# Note: the Python version, Emscripten toolchain version are determined
396397
# by the Pyodide version. The appropriate versions can be found in the

.github/workflows/wheels.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ jobs:
100100
- [windows-2022, win_amd64]
101101
# TODO: support PyPy?
102102
python: [["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"]]
103+
104+
# Build Pyodide wheels and upload them to Anaconda.org
105+
# NOTE: this job is similar to the one in unit-tests.yml except for the fact
106+
# that it uses cibuildwheel instead of a standard Pyodide xbuildenv setup.
107+
include:
108+
- buildplat: [ubuntu-22.04, pyodide_wasm32]
109+
python: ["cp312", "3.12"]
103110
env:
104111
IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
105112
IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
@@ -140,12 +147,13 @@ jobs:
140147
run: echo "sdist_name=$(cd ./dist && ls -d */)" >> "$GITHUB_ENV"
141148

142149
- name: Build wheels
143-
uses: pypa/cibuildwheel@v2.19.1
150+
uses: pypa/cibuildwheel@v2.19.2
144151
with:
145152
package-dir: ./dist/${{ startsWith(matrix.buildplat[1], 'macosx') && env.sdist_name || needs.build_sdist.outputs.sdist_file }}
146153
env:
147154
CIBW_PRERELEASE_PYTHONS: True
148155
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
156+
CIBW_PLATFORM: ${{ matrix.buildplat[1] == 'pyodide_wasm32' && 'pyodide' || 'auto' }}
149157

150158
- name: Set up Python
151159
uses: mamba-org/setup-micromamba@v1

asv_bench/benchmarks/indexing.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -546,24 +546,17 @@ def time_chained_indexing(self, mode):
546546

547547

548548
class Block:
549-
params = [
550-
(True, "True"),
551-
(np.array(True), "np.array(True)"),
552-
]
553-
554-
def setup(self, true_value, mode):
549+
def setup(self):
555550
self.df = DataFrame(
556551
False,
557552
columns=np.arange(500).astype(str),
558553
index=date_range("2010-01-01", "2011-01-01"),
559554
)
560555

561-
self.true_value = true_value
562-
563-
def time_test(self, true_value, mode):
556+
def time_test(self):
564557
start = datetime(2010, 5, 1)
565558
end = datetime(2010, 9, 1)
566-
self.df.loc[start:end, :] = true_value
559+
self.df.loc[start:end, :] = True
567560

568561

569562
from .pandas_vb_common import setup # noqa: F401 isort:skip

ci/code_checks.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
7070
--format=actions \
7171
-i ES01 `# For now it is ok if docstrings are missing the extended summary` \
7272
-i "pandas.Series.dt PR01" `# Accessors are implemented as classes, but we do not document the Parameters section` \
73-
-i "pandas.DataFrame.max RT03" \
74-
-i "pandas.DataFrame.mean RT03" \
75-
-i "pandas.DataFrame.median RT03" \
76-
-i "pandas.DataFrame.min RT03" \
7773
-i "pandas.DataFrame.plot PR02" \
7874
-i "pandas.Grouper PR02" \
7975
-i "pandas.MultiIndex.append PR07,SA01" \
@@ -95,7 +91,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
9591
-i "pandas.Period.freq GL08" \
9692
-i "pandas.Period.freqstr SA01" \
9793
-i "pandas.Period.month SA01" \
98-
-i "pandas.Period.now SA01" \
9994
-i "pandas.Period.ordinal GL08" \
10095
-i "pandas.Period.strftime PR01,SA01" \
10196
-i "pandas.Period.to_timestamp SA01" \
@@ -167,7 +162,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
167162
-i "pandas.Series.product RT03" \
168163
-i "pandas.Series.reorder_levels RT03,SA01" \
169164
-i "pandas.Series.sem PR01,RT03,SA01" \
170-
-i "pandas.Series.skew RT03,SA01" \
165+
-i "pandas.Series.skew SA01" \
171166
-i "pandas.Series.sparse PR01,SA01" \
172167
-i "pandas.Series.sparse.density SA01" \
173168
-i "pandas.Series.sparse.fill_value SA01" \

doc/source/getting_started/intro_tutorials/04_plotting.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ How do I create plots in pandas?
3232
air_quality.head()
3333
3434
.. note::
35-
The usage of the ``index_col`` and ``parse_dates`` parameters of the ``read_csv`` function to define the first (0th) column as
36-
index of the resulting ``DataFrame`` and convert the dates in the column to :class:`Timestamp` objects, respectively.
35+
The ``index_col=0`` and ``parse_dates=True`` parameters passed to the ``read_csv`` function define
36+
the first (0th) column as index of the resulting ``DataFrame`` and convert the dates in the column
37+
to :class:`Timestamp` objects, respectively.
38+
3739

3840
.. raw:: html
3941

doc/source/getting_started/overview.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
Package overview
77
****************
88

9-
pandas is a `Python <https://www.python.org>`__ package providing fast,
9+
pandas is a `Python <https://www.python.org>`__ package that provides fast,
1010
flexible, and expressive data structures designed to make working with
1111
"relational" or "labeled" data both easy and intuitive. It aims to be the
12-
fundamental high-level building block for doing practical, **real-world** data
13-
analysis in Python. Additionally, it has the broader goal of becoming **the
12+
fundamental high-level building block for Python's practical, **real-world** data
13+
analysis. Additionally, it seeks to become **the
1414
most powerful and flexible open source data analysis/manipulation tool
1515
available in any language**. It is already well on its way toward this goal.
1616

doc/source/user_guide/categorical.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ Assigning a ``Categorical`` to parts of a column of other types will use the val
793793
:okwarning:
794794
795795
df = pd.DataFrame({"a": [1, 1, 1, 1, 1], "b": ["a", "a", "a", "a", "a"]})
796-
df.loc[1:2, "a"] = pd.Categorical(["b", "b"], categories=["a", "b"])
796+
df.loc[1:2, "a"] = pd.Categorical([2, 2], categories=[2, 3])
797797
df.loc[2:3, "b"] = pd.Categorical(["b", "b"], categories=["a", "b"])
798798
df
799799
df.dtypes

doc/source/user_guide/io.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,7 +2161,7 @@ a JSON string with two fields, ``schema`` and ``data``.
21612161
{
21622162
"A": [1, 2, 3],
21632163
"B": ["a", "b", "c"],
2164-
"C": pd.date_range("2016-01-01", freq="d", periods=3),
2164+
"C": pd.date_range("2016-01-01", freq="D", periods=3),
21652165
},
21662166
index=pd.Index(range(3), name="idx"),
21672167
)
@@ -2270,7 +2270,7 @@ round-trippable manner.
22702270
{
22712271
"foo": [1, 2, 3, 4],
22722272
"bar": ["a", "b", "c", "d"],
2273-
"baz": pd.date_range("2018-01-01", freq="d", periods=4),
2273+
"baz": pd.date_range("2018-01-01", freq="D", periods=4),
22742274
"qux": pd.Categorical(["a", "b", "c", "c"]),
22752275
},
22762276
index=pd.Index(range(4), name="idx"),

doc/source/whatsnew/v0.18.0.rst

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -322,15 +322,28 @@ Tz-aware are rounded, floored and ceiled in local times
322322
323323
Timedeltas
324324

325-
.. ipython:: python
325+
.. code-block:: ipython
326+
327+
In [37]: t = pd.timedelta_range('1 days 2 hr 13 min 45 us', periods=3, freq='d')
326328
327-
t = pd.timedelta_range('1 days 2 hr 13 min 45 us', periods=3, freq='d')
328-
t
329-
t.round('10min')
329+
In [38]: t
330+
Out[38]:
331+
TimedeltaIndex(['1 days 02:13:00.000045', '2 days 02:13:00.000045',
332+
'3 days 02:13:00.000045'],
333+
dtype='timedelta64[ns]', freq='D')
334+
335+
In [39]: t.round('10min')
336+
Out[39]:
337+
TimedeltaIndex(['1 days 02:10:00', '2 days 02:10:00',
338+
'3 days 02:10:00'],
339+
dtype='timedelta64[ns]', freq=None)
330340
331341
# Timedelta scalar
332-
t[0]
333-
t[0].round('2h')
342+
In [40]: t[0]
343+
Out[40]: Timedelta('1 days 02:13:00.000045')
344+
345+
In [41]: t[0].round('2h')
346+
Out[41]: Timedelta('1 days 02:00:00')
334347
335348
336349
In addition, ``.round()``, ``.floor()`` and ``.ceil()`` will be available through the ``.dt`` accessor of ``Series``.

doc/source/whatsnew/v0.20.0.rst

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -308,15 +308,26 @@ The new orient ``'table'`` for :meth:`DataFrame.to_json`
308308
will generate a `Table Schema`_ compatible string representation of
309309
the data.
310310

311-
.. ipython:: python
311+
.. code-block:: ipython
312312
313-
df = pd.DataFrame(
314-
{'A': [1, 2, 3],
315-
'B': ['a', 'b', 'c'],
316-
'C': pd.date_range('2016-01-01', freq='d', periods=3)},
317-
index=pd.Index(range(3), name='idx'))
318-
df
319-
df.to_json(orient='table')
313+
In [38]: df = pd.DataFrame(
314+
....: {'A': [1, 2, 3],
315+
....: 'B': ['a', 'b', 'c'],
316+
....: 'C': pd.date_range('2016-01-01', freq='d', periods=3)},
317+
....: index=pd.Index(range(3), name='idx'))
318+
In [39]: df
319+
Out[39]:
320+
A B C
321+
idx
322+
0 1 a 2016-01-01
323+
1 2 b 2016-01-02
324+
2 3 c 2016-01-03
325+
326+
[3 rows x 3 columns]
327+
328+
In [40]: df.to_json(orient='table')
329+
Out[40]:
330+
'{"schema":{"fields":[{"name":"idx","type":"integer"},{"name":"A","type":"integer"},{"name":"B","type":"string"},{"name":"C","type":"datetime"}],"primaryKey":["idx"],"pandas_version":"1.4.0"},"data":[{"idx":0,"A":1,"B":"a","C":"2016-01-01T00:00:00.000"},{"idx":1,"A":2,"B":"b","C":"2016-01-02T00:00:00.000"},{"idx":2,"A":3,"B":"c","C":"2016-01-03T00:00:00.000"}]}'
320331
321332
322333
See :ref:`IO: Table Schema for more information <io.table_schema>`.

0 commit comments

Comments
 (0)