Skip to content

Commit 9b74934

Browse files
authored
Merge branch 'main' into issue_61863
2 parents e0f1f37 + 6537afe commit 9b74934

File tree

12 files changed

+69
-43
lines changed

12 files changed

+69
-43
lines changed

.github/workflows/docbuild-and-upload.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ jobs:
5757
run: python web/pandas_web.py web/pandas --target-path=web/build
5858

5959
- name: Build documentation
60-
# TEMP don't let errors fail the build until all string dtype changes are fixed
61-
continue-on-error: true
6260
run: doc/make.py --warnings-are-errors
6361

6462
- name: Build the interactive terminal

doc/source/user_guide/basics.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ arguments. The special value ``all`` can also be used:
590590

591591
.. ipython:: python
592592
593-
frame.describe(include=["object"])
593+
frame.describe(include=["str"])
594594
frame.describe(include=["number"])
595595
frame.describe(include="all")
596596

doc/source/whatsnew/v0.13.0.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ API changes
184184
.. ipython:: python
185185
:okwarning:
186186
187-
dfc.loc[0]['A'] = 1111
187+
dfc.loc[0]['B'] = 1111
188188
189189
::
190190

@@ -198,7 +198,7 @@ API changes
198198

199199
.. ipython:: python
200200
201-
dfc.loc[0, 'A'] = 11
201+
dfc.loc[0, 'B'] = 1111
202202
dfc
203203
204204
- ``Panel.reindex`` has the following call signature ``Panel.reindex(items=None, major_axis=None, minor_axis=None, **kwargs)``

doc/source/whatsnew/v0.15.0.rst

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,20 +1025,49 @@ Other:
10251025
- :func:`describe` on mixed-types DataFrames is more flexible. Type-based column filtering is now possible via the ``include``/``exclude`` arguments.
10261026
See the :ref:`docs <basics.describe>` (:issue:`8164`).
10271027

1028-
.. ipython:: python
1028+
.. code-block:: python
10291029
1030-
df = pd.DataFrame({'catA': ['foo', 'foo', 'bar'] * 8,
1031-
'catB': ['a', 'b', 'c', 'd'] * 6,
1032-
'numC': np.arange(24),
1033-
'numD': np.arange(24.) + .5})
1034-
df.describe(include=["object"])
1035-
df.describe(include=["number", "object"], exclude=["float"])
1030+
>>> df = pd.DataFrame({'catA': ['foo', 'foo', 'bar'] * 8,
1031+
... 'catB': ['a', 'b', 'c', 'd'] * 6,
1032+
... 'numC': np.arange(24),
1033+
... 'numD': np.arange(24.) + .5})
1034+
>>> df.describe(include=["object"])
1035+
catA catB
1036+
count 24 24
1037+
unique 2 4
1038+
top foo a
1039+
freq 16 6
1040+
>>> df.describe(include=["number", "object"], exclude=["float"])
1041+
catA catB numC
1042+
count 24 24 24.000000
1043+
unique 2 4 NaN
1044+
top foo a NaN
1045+
freq 16 6 NaN
1046+
mean NaN NaN 11.500000
1047+
std NaN NaN 7.071068
1048+
min NaN NaN 0.000000
1049+
25% NaN NaN 5.750000
1050+
50% NaN NaN 11.500000
1051+
75% NaN NaN 17.250000
1052+
max NaN NaN 23.000000
10361053
10371054
Requesting all columns is possible with the shorthand 'all'
10381055

1039-
.. ipython:: python
1056+
.. code-block:: python
10401057
1041-
df.describe(include='all')
1058+
>>> df.describe(include='all')
1059+
catA catB numC numD
1060+
count 24 24 24.000000 24.000000
1061+
unique 2 4 NaN NaN
1062+
top foo a NaN NaN
1063+
freq 16 6 NaN NaN
1064+
mean NaN NaN 11.500000 12.000000
1065+
std NaN NaN 7.071068 7.071068
1066+
min NaN NaN 0.000000 0.500000
1067+
25% NaN NaN 5.750000 6.250000
1068+
50% NaN NaN 11.500000 12.000000
1069+
75% NaN NaN 17.250000 17.750000
1070+
max NaN NaN 23.000000 23.500000
10421071
10431072
Without those arguments, ``describe`` will behave as before, including only numerical columns or, if none are, only categorical columns. See also the :ref:`docs <basics.describe>`
10441073

pandas/core/arrays/categorical.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -794,28 +794,28 @@ def categories(self) -> Index:
794794
795795
>>> ser = pd.Series(["a", "b", "c", "a"], dtype="category")
796796
>>> ser.cat.categories
797-
Index(['a', 'b', 'c'], dtype='object')
797+
Index(['a', 'b', 'c'], dtype='str')
798798
799799
>>> raw_cat = pd.Categorical(["a", "b", "c", "a"], categories=["b", "c", "d"])
800800
>>> ser = pd.Series(raw_cat)
801801
>>> ser.cat.categories
802-
Index(['b', 'c', 'd'], dtype='object')
802+
Index(['b', 'c', 'd'], dtype='str')
803803
804804
For :class:`pandas.Categorical`:
805805
806806
>>> cat = pd.Categorical(["a", "b"], ordered=True)
807807
>>> cat.categories
808-
Index(['a', 'b'], dtype='object')
808+
Index(['a', 'b'], dtype='str')
809809
810810
For :class:`pandas.CategoricalIndex`:
811811
812812
>>> ci = pd.CategoricalIndex(["a", "c", "b", "a", "c", "b"])
813813
>>> ci.categories
814-
Index(['a', 'b', 'c'], dtype='object')
814+
Index(['a', 'b', 'c'], dtype='str')
815815
816816
>>> ci = pd.CategoricalIndex(["a", "c"], categories=["c", "b", "a"])
817817
>>> ci.categories
818-
Index(['c', 'b', 'a'], dtype='object')
818+
Index(['c', 'b', 'a'], dtype='str')
819819
"""
820820
return self.dtype.categories
821821

pandas/core/dtypes/dtypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ def categories(self) -> Index:
647647
--------
648648
>>> cat_type = pd.CategoricalDtype(categories=["a", "b"], ordered=True)
649649
>>> cat_type.categories
650-
Index(['a', 'b'], dtype='object')
650+
Index(['a', 'b'], dtype='str')
651651
"""
652652
return self._categories
653653

pandas/core/dtypes/missing.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ def isna(obj: object) -> bool | npt.NDArray[np.bool_] | NDFrame:
158158
159159
>>> df = pd.DataFrame([["ant", "bee", "cat"], ["dog", None, "fly"]])
160160
>>> df
161-
0 1 2
162-
0 ant bee cat
163-
1 dog None fly
161+
0 1 2
162+
0 ant bee cat
163+
1 dog NaN fly
164164
>>> pd.isna(df)
165165
0 1 2
166166
0 False False False
@@ -373,9 +373,9 @@ def notna(obj: object) -> bool | npt.NDArray[np.bool_] | NDFrame:
373373
374374
>>> df = pd.DataFrame([["ant", "bee", "cat"], ["dog", None, "fly"]])
375375
>>> df
376-
0 1 2
377-
0 ant bee cat
378-
1 dog None fly
376+
0 1 2
377+
0 ant bee cat
378+
1 dog NaN fly
379379
>>> pd.notna(df)
380380
0 1 2
381381
0 True True True

pandas/core/frame.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,8 +1015,7 @@ def axes(self) -> list[Index]:
10151015
--------
10161016
>>> df = pd.DataFrame({"col1": [1, 2], "col2": [3, 4]})
10171017
>>> df.axes
1018-
[RangeIndex(start=0, stop=2, step=1), Index(['col1', 'col2'],
1019-
dtype='object')]
1018+
[RangeIndex(start=0, stop=2, step=1), Index(['col1', 'col2'], dtype='str')]
10201019
"""
10211020
return [self.index, self.columns]
10221021

@@ -14070,7 +14069,7 @@ def values(self) -> np.ndarray:
1407014069
... columns=("name", "max_speed", "rank"),
1407114070
... )
1407214071
>>> df2.dtypes
14073-
name object
14072+
name str
1407414073
max_speed float64
1407514074
rank object
1407614075
dtype: object

pandas/core/groupby/groupby.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4628,13 +4628,13 @@ def ngroup(self, ascending: bool = True):
46284628
--------
46294629
>>> df = pd.DataFrame({"color": ["red", None, "red", "blue", "blue", "red"]})
46304630
>>> df
4631-
color
4632-
0 red
4633-
1 None
4634-
2 red
4635-
3 blue
4636-
4 blue
4637-
5 red
4631+
color
4632+
0 red
4633+
1 NaN
4634+
2 red
4635+
3 blue
4636+
4 blue
4637+
5 red
46384638
>>> df.groupby("color").ngroup()
46394639
0 1.0
46404640
1 NaN

pandas/core/indexes/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ class Index(IndexOpsMixin, PandasObject):
368368
Index([1, 2, 3], dtype='int64')
369369
370370
>>> pd.Index(list("abc"))
371-
Index(['a', 'b', 'c'], dtype='object')
371+
Index(['a', 'b', 'c'], dtype='str')
372372
373373
>>> pd.Index([1, 2, 3], dtype="uint8")
374374
Index([1, 2, 3], dtype='uint8')
@@ -7599,7 +7599,7 @@ def ensure_index(index_like: Axes, copy: bool = False) -> Index:
75997599
Examples
76007600
--------
76017601
>>> ensure_index(["a", "b"])
7602-
Index(['a', 'b'], dtype='object')
7602+
Index(['a', 'b'], dtype='str')
76037603
76047604
>>> ensure_index([("a", "a"), ("b", "c")])
76057605
Index([('a', 'a'), ('b', 'c')], dtype='object')

0 commit comments

Comments
 (0)