Skip to content

DOC: fix doctests for pandas/core/generic.py for new string dtype #61907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1918,7 +1918,7 @@ def keys(self) -> Index:
b 2 4
c 3 8
>>> d.keys()
Index(['A', 'B'], dtype='object')
Index(['A', 'B'], dtype='str')
"""
return self._info_axis

Expand Down Expand Up @@ -6276,7 +6276,7 @@ def dtypes(self):
float float64
int int64
datetime datetime64[s]
string object
string str
dtype: object
"""
data = self._mgr.get_dtypes()
Expand Down Expand Up @@ -6838,7 +6838,7 @@ def convert_dtypes(
0 a
1 b
2 NaN
dtype: object
dtype: str

Obtain a Series with dtype ``StringDtype``.

Expand Down Expand Up @@ -8138,7 +8138,7 @@ def isna(self) -> Self:
... )
>>> df
age born name toy
0 5.0 NaT Alfred None
0 5.0 NaT Alfred NaN
1 6.0 1939-05-27 Batman Batmobile
2 NaN 1940-04-25 Joker

Expand Down Expand Up @@ -8211,7 +8211,7 @@ def notna(self) -> Self:
... )
>>> df
age born name toy
0 5.0 NaT Alfred None
0 5.0 NaT Alfred NaN
1 6.0 1939-05-27 Batman Batmobile
2 NaN 1940-04-25 Joker

Expand Down Expand Up @@ -10401,7 +10401,7 @@ def truncate(
2 b
3 c
4 d
Name: A, dtype: object
Name: A, dtype: str

The index values in ``truncate`` can be datetimes or string
dates.
Expand Down Expand Up @@ -11804,7 +11804,7 @@ def first_valid_index(self) -> Hashable:
>>> print(df.last_valid_index())
None

If all elements in DataFrame are NA/null, returns None.
If all elements in DataFrame are NA/null, returns NaN.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example below still shows None?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah my bad, thanks.


>>> df = pd.DataFrame()
>>> df
Expand Down
Loading