Skip to content

Commit a5c7946

Browse files
authored
DOC: Fixing EX03 - Removing flake8 errors in docstrings (#55401)
fixing EX03 errors
1 parent 6d4819b commit a5c7946

File tree

5 files changed

+24
-34
lines changed

5 files changed

+24
-34
lines changed

ci/code_checks.sh

-10
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
6363

6464
MSG='Partially validate docstrings (EX03)' ; echo $MSG
6565
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX03 --ignore_functions \
66-
pandas.Series.loc \
67-
pandas.Series.iloc \
68-
pandas.Series.pop \
69-
pandas.Series.describe \
70-
pandas.Series.skew \
71-
pandas.Series.var \
72-
pandas.Series.last \
73-
pandas.Series.tz_convert \
74-
pandas.Series.tz_localize \
75-
pandas.Series.dt.month_name \
7666
pandas.Series.dt.day_name \
7767
pandas.Series.str.len \
7868
pandas.Series.cat.set_categories \

pandas/core/arrays/datetimes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,7 @@ def month_name(self, locale=None) -> npt.NDArray[np.object_]:
12761276
>>> idx
12771277
DatetimeIndex(['2018-01-31', '2018-02-28', '2018-03-31'],
12781278
dtype='datetime64[ns]', freq='ME')
1279-
>>> idx.month_name(locale='pt_BR.utf8') # doctest: +SKIP
1279+
>>> idx.month_name(locale='pt_BR.utf8') # doctest: +SKIP
12801280
Index(['Janeiro', 'Fevereiro', 'Março'], dtype='object')
12811281
"""
12821282
values = self._local_timestamps()

pandas/core/generic.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -9698,7 +9698,7 @@ def last(self, offset) -> Self:
96989698
96999699
Get the rows for the last 3 days:
97009700
9701-
>>> ts.last('3D') # doctest: +SKIP
9701+
>>> ts.last('3D') # doctest: +SKIP
97029702
A
97039703
2018-04-13 3
97049704
2018-04-15 4
@@ -11208,7 +11208,7 @@ def tz_convert(
1120811208
Pass None to convert to UTC and get a tz-naive index:
1120911209
1121011210
>>> s = pd.Series([1],
11211-
... index=pd.DatetimeIndex(['2018-09-15 01:30:00+02:00']))
11211+
... index=pd.DatetimeIndex(['2018-09-15 01:30:00+02:00']))
1121211212
>>> s.tz_convert(None)
1121311213
2018-09-14 23:30:00 1
1121411214
dtype: int64
@@ -11326,7 +11326,7 @@ def tz_localize(
1132611326
Pass None to convert to tz-naive index and preserve local time:
1132711327
1132811328
>>> s = pd.Series([1],
11329-
... index=pd.DatetimeIndex(['2018-09-15 01:30:00+02:00']))
11329+
... index=pd.DatetimeIndex(['2018-09-15 01:30:00+02:00']))
1133011330
>>> s.tz_localize(None)
1133111331
2018-09-15 01:30:00 1
1133211332
dtype: int64
@@ -11569,10 +11569,10 @@ def describe(
1156911569
Describing a ``DataFrame``. By default only numeric fields
1157011570
are returned.
1157111571
11572-
>>> df = pd.DataFrame({'categorical': pd.Categorical(['d','e','f']),
11572+
>>> df = pd.DataFrame({'categorical': pd.Categorical(['d', 'e', 'f']),
1157311573
... 'numeric': [1, 2, 3],
1157411574
... 'object': ['a', 'b', 'c']
11575-
... })
11575+
... })
1157611576
>>> df.describe()
1157711577
numeric
1157811578
count 3.0
@@ -12688,9 +12688,9 @@ def last_valid_index(self) -> Hashable | None:
1268812688
Examples
1268912689
--------
1269012690
>>> df = pd.DataFrame({'person_id': [0, 1, 2, 3],
12691-
... 'age': [21, 25, 62, 43],
12692-
... 'height': [1.61, 1.87, 1.49, 2.01]}
12693-
... ).set_index('person_id')
12691+
... 'age': [21, 25, 62, 43],
12692+
... 'height': [1.61, 1.87, 1.49, 2.01]}
12693+
... ).set_index('person_id')
1269412694
>>> df
1269512695
age height
1269612696
person_id
@@ -13516,7 +13516,7 @@ def make_doc(name: str, ndim: int) -> str:
1351613516
With a DataFrame
1351713517
1351813518
>>> df = pd.DataFrame({'a': [1, 2, 3], 'b': [2, 3, 4], 'c': [1, 3, 5]},
13519-
... index=['tiger', 'zebra', 'cow'])
13519+
... index=['tiger', 'zebra', 'cow'])
1352013520
>>> df
1352113521
a b c
1352213522
tiger 1 2 1
@@ -13540,7 +13540,7 @@ def make_doc(name: str, ndim: int) -> str:
1354013540
getting an error.
1354113541
1354213542
>>> df = pd.DataFrame({'a': [1, 2, 3], 'b': ['T', 'Z', 'X']},
13543-
... index=['tiger', 'zebra', 'cow'])
13543+
... index=['tiger', 'zebra', 'cow'])
1354413544
>>> df.skew(numeric_only=True)
1354513545
a 0.0
1354613546
dtype: float64"""

pandas/core/indexing.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def iloc(self) -> _iLocIndexer:
187187
--------
188188
>>> mydict = [{'a': 1, 'b': 2, 'c': 3, 'd': 4},
189189
... {'a': 100, 'b': 200, 'c': 300, 'd': 400},
190-
... {'a': 1000, 'b': 2000, 'c': 3000, 'd': 4000 }]
190+
... {'a': 1000, 'b': 2000, 'c': 3000, 'd': 4000}]
191191
>>> df = pd.DataFrame(mydict)
192192
>>> df
193193
a b c d
@@ -328,16 +328,16 @@ def loc(self) -> _LocIndexer:
328328
DataFrame.at : Access a single value for a row/column label pair.
329329
DataFrame.iloc : Access group of rows and columns by integer position(s).
330330
DataFrame.xs : Returns a cross-section (row(s) or column(s)) from the
331-
Series/DataFrame.
331+
Series/DataFrame.
332332
Series.loc : Access group of values using labels.
333333
334334
Examples
335335
--------
336336
**Getting values**
337337
338338
>>> df = pd.DataFrame([[1, 2], [4, 5], [7, 8]],
339-
... index=['cobra', 'viper', 'sidewinder'],
340-
... columns=['max_speed', 'shield'])
339+
... index=['cobra', 'viper', 'sidewinder'],
340+
... columns=['max_speed', 'shield'])
341341
>>> df
342342
max_speed shield
343343
cobra 1 2
@@ -380,8 +380,8 @@ def loc(self) -> _LocIndexer:
380380
Alignable boolean Series:
381381
382382
>>> df.loc[pd.Series([False, True, False],
383-
... index=['viper', 'sidewinder', 'cobra'])]
384-
max_speed shield
383+
... index=['viper', 'sidewinder', 'cobra'])]
384+
max_speed shield
385385
sidewinder 7 8
386386
387387
Index (same behavior as ``df.reindex``)
@@ -407,7 +407,7 @@ def loc(self) -> _LocIndexer:
407407
Multiple conditional using ``&`` that returns a boolean Series
408408
409409
>>> df.loc[(df['max_speed'] > 1) & (df['shield'] < 8)]
410-
max_speed shield
410+
max_speed shield
411411
viper 4 5
412412
413413
Multiple conditional using ``|`` that returns a boolean Series
@@ -496,7 +496,7 @@ def loc(self) -> _LocIndexer:
496496
Another example using integers for the index
497497
498498
>>> df = pd.DataFrame([[1, 2], [4, 5], [7, 8]],
499-
... index=[7, 8, 9], columns=['max_speed', 'shield'])
499+
... index=[7, 8, 9], columns=['max_speed', 'shield'])
500500
>>> df
501501
max_speed shield
502502
7 1 2
@@ -517,13 +517,13 @@ def loc(self) -> _LocIndexer:
517517
A number of examples using a DataFrame with a MultiIndex
518518
519519
>>> tuples = [
520-
... ('cobra', 'mark i'), ('cobra', 'mark ii'),
521-
... ('sidewinder', 'mark i'), ('sidewinder', 'mark ii'),
522-
... ('viper', 'mark ii'), ('viper', 'mark iii')
520+
... ('cobra', 'mark i'), ('cobra', 'mark ii'),
521+
... ('sidewinder', 'mark i'), ('sidewinder', 'mark ii'),
522+
... ('viper', 'mark ii'), ('viper', 'mark iii')
523523
... ]
524524
>>> index = pd.MultiIndex.from_tuples(tuples)
525525
>>> values = [[12, 2], [0, 4], [10, 20],
526-
... [1, 4], [7, 1], [16, 36]]
526+
... [1, 4], [7, 1], [16, 36]]
527527
>>> df = pd.DataFrame(values, columns=['max_speed', 'shield'], index=index)
528528
>>> df
529529
max_speed shield

pandas/core/series.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5186,7 +5186,7 @@ def pop(self, item: Hashable) -> Any:
51865186
51875187
Examples
51885188
--------
5189-
>>> ser = pd.Series([1,2,3])
5189+
>>> ser = pd.Series([1, 2, 3])
51905190
51915191
>>> ser.pop(0)
51925192
1

0 commit comments

Comments
 (0)