Skip to content

Commit 5d9fd7e

Browse files
realjohnwardWillAyd
authored andcommitted
DOC: Fixes to docstrings formatting (#28096)
1 parent 97f9bbf commit 5d9fd7e

File tree

5 files changed

+68
-50
lines changed

5 files changed

+68
-50
lines changed

pandas/core/generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1875,7 +1875,7 @@ def __iter__(self):
18751875
# can we get a better explanation of this?
18761876
def keys(self):
18771877
"""
1878-
Get the 'info axis' (see Indexing for more)
1878+
Get the 'info axis' (see Indexing for more).
18791879
18801880
This is index for Series, columns for DataFrame.
18811881

pandas/io/clipboards.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,21 @@
99

1010
def read_clipboard(sep=r"\s+", **kwargs): # pragma: no cover
1111
r"""
12-
Read text from clipboard and pass to read_csv. See read_csv for the
13-
full argument list
12+
Read text from clipboard and pass to read_csv.
1413
1514
Parameters
1615
----------
1716
sep : str, default '\s+'
1817
A string or regex delimiter. The default of '\s+' denotes
1918
one or more whitespace characters.
2019
20+
**kwargs
21+
See read_csv for the full argument list.
22+
2123
Returns
2224
-------
23-
parsed : DataFrame
25+
DataFrame
26+
A parsed DataFrame object.
2427
"""
2528
encoding = kwargs.pop("encoding", "utf-8")
2629

pandas/io/excel/_base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -837,10 +837,10 @@ def parse(
837837
**kwds
838838
):
839839
"""
840-
Parse specified sheet(s) into a DataFrame
840+
Parse specified sheet(s) into a DataFrame.
841841
842842
Equivalent to read_excel(ExcelFile, ...) See the read_excel
843-
docstring for more info on accepted parameters
843+
docstring for more info on accepted parameters.
844844
845845
Returns
846846
-------

pandas/io/pytables.py

+53-40
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,9 @@ def _is_metadata_of(group, parent_group):
431431
class HDFStore:
432432

433433
"""
434-
Dict-like IO interface for storing pandas objects in PyTables
435-
either Fixed or Table format.
434+
Dict-like IO interface for storing pandas objects in PyTables.
435+
436+
Either Fixed or Table format.
436437
437438
Parameters
438439
----------
@@ -564,13 +565,12 @@ def __exit__(self, exc_type, exc_value, traceback):
564565

565566
def keys(self):
566567
"""
567-
Return a (potentially unordered) list of the keys corresponding to the
568-
objects stored in the HDFStore. These are ABSOLUTE path-names (e.g.
569-
have the leading '/'
568+
Return a list of keys corresponding to objects stored in HDFStore.
570569
571570
Returns
572571
-------
573572
list
573+
List of ABSOLUTE path-names (e.g. have the leading '/').
574574
"""
575575
return [n._v_pathname for n in self.groups()]
576576

@@ -703,15 +703,16 @@ def flush(self, fsync=False):
703703

704704
def get(self, key):
705705
"""
706-
Retrieve pandas object stored in file
706+
Retrieve pandas object stored in file.
707707
708708
Parameters
709709
----------
710710
key : object
711711
712712
Returns
713713
-------
714-
obj : same type as object stored in file
714+
object
715+
Same type as object stored in file.
715716
"""
716717
group = self.get_node(key)
717718
if group is None:
@@ -731,25 +732,31 @@ def select(
731732
**kwargs
732733
):
733734
"""
734-
Retrieve pandas object stored in file, optionally based on where
735-
criteria
735+
Retrieve pandas object stored in file, optionally based on where criteria.
736736
737737
Parameters
738738
----------
739739
key : object
740-
where : list of Term (or convertible) objects, optional
741-
start : integer (defaults to None), row number to start selection
742-
stop : integer (defaults to None), row number to stop selection
743-
columns : a list of columns that if not None, will limit the return
744-
columns
745-
iterator : boolean, return an iterator, default False
746-
chunksize : nrows to include in iteration, return an iterator
747-
auto_close : boolean, should automatically close the store when
748-
finished, default is False
740+
Object being retrieved from file.
741+
where : list, default None
742+
List of Term (or convertible) objects, optional.
743+
start : int, default None
744+
Row number to start selection.
745+
stop : int, default None
746+
Row number to stop selection.
747+
columns : list, default None
748+
A list of columns that if not None, will limit the return columns.
749+
iterator : bool, default False
750+
Returns an iterator.
751+
chunksize : int, default None
752+
Number or rows to include in iteration, return an iterator.
753+
auto_close : bool, default False
754+
Should automatically close the store when finished.
749755
750756
Returns
751757
-------
752-
The selected object
758+
object
759+
Retrieved object from file.
753760
"""
754761
group = self.get_node(key)
755762
if group is None:
@@ -929,28 +936,30 @@ def func(_start, _stop, _where):
929936

930937
def put(self, key, value, format=None, append=False, **kwargs):
931938
"""
932-
Store object in HDFStore
939+
Store object in HDFStore.
933940
934941
Parameters
935942
----------
936-
key : object
937-
value : {Series, DataFrame}
938-
format : 'fixed(f)|table(t)', default is 'fixed'
943+
key : object
944+
value : {Series, DataFrame}
945+
format : 'fixed(f)|table(t)', default is 'fixed'
939946
fixed(f) : Fixed format
940-
Fast writing/reading. Not-appendable, nor searchable
947+
Fast writing/reading. Not-appendable, nor searchable.
941948
table(t) : Table format
942949
Write as a PyTables Table structure which may perform
943950
worse but allow more flexible operations like searching
944-
/ selecting subsets of the data
945-
append : boolean, default False
951+
/ selecting subsets of the data.
952+
append : bool, default False
946953
This will force Table format, append the input data to the
947954
existing.
948-
data_columns : list of columns to create as data columns, or True to
955+
data_columns : list, default None
956+
List of columns to create as data columns, or True to
949957
use all columns. See `here
950958
<http://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#query-via-data-columns>`__.
951-
encoding : default None, provide an encoding for strings
952-
dropna : boolean, default False, do not write an ALL nan row to
953-
the store settable by the option 'io.hdf.dropna_table'
959+
encoding : str, default None
960+
Provide an encoding for strings.
961+
dropna : bool, default False, do not write an ALL nan row to
962+
The store settable by the option 'io.hdf.dropna_table'.
954963
"""
955964
if format is None:
956965
format = get_option("io.hdf.default_format") or "fixed"
@@ -1165,12 +1174,15 @@ def create_table_index(self, key, **kwargs):
11651174
s.create_index(**kwargs)
11661175

11671176
def groups(self):
1168-
"""return a list of all the top-level nodes (that are not themselves a
1169-
pandas storage object)
1177+
"""
1178+
Return a list of all the top-level nodes.
1179+
1180+
Each node returned is not a pandas storage object.
11701181
11711182
Returns
11721183
-------
11731184
list
1185+
List of objects.
11741186
"""
11751187
_tables()
11761188
self._check_if_open()
@@ -1188,10 +1200,12 @@ def groups(self):
11881200
]
11891201

11901202
def walk(self, where="/"):
1191-
""" Walk the pytables group hierarchy for pandas objects
1203+
"""
1204+
Walk the pytables group hierarchy for pandas objects.
11921205
11931206
This generator will yield the group path, subgroups and pandas object
11941207
names for each group.
1208+
11951209
Any non-pandas PyTables objects that are not a group will be ignored.
11961210
11971211
The `where` group itself is listed first (preorder), then each of its
@@ -1202,18 +1216,17 @@ def walk(self, where="/"):
12021216
12031217
Parameters
12041218
----------
1205-
where : str, optional
1219+
where : str, default "/"
12061220
Group where to start walking.
1207-
If not supplied, the root group is used.
12081221
12091222
Yields
12101223
------
12111224
path : str
1212-
Full path to a group (without trailing '/')
1213-
groups : list of str
1214-
names of the groups contained in `path`
1215-
leaves : list of str
1216-
names of the pandas objects contained in `path`
1225+
Full path to a group (without trailing '/').
1226+
groups : list
1227+
Names (strings) of the groups contained in `path`.
1228+
leaves : list
1229+
Names (strings) of the pandas objects contained in `path`.
12171230
"""
12181231
_tables()
12191232
self._check_if_open()

pandas/tseries/offsets.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ def __add__(date):
204204
normalize : bool, default False
205205
Whether to round the result of a DateOffset addition down to the
206206
previous midnight.
207-
**kwds
208-
Temporal parameter that add to or replace the offset value.
207+
**kwds : Temporal parameter that add to or replace the offset value.
209208
210209
Parameters that **add** to the offset (like Timedelta):
211210
@@ -233,16 +232,19 @@ def __add__(date):
233232
234233
See Also
235234
--------
236-
dateutil.relativedelta.relativedelta
235+
dateutil.relativedelta.relativedelta : The relativedelta type is designed
236+
to be applied to an existing datetime an can replace specific components of
237+
that datetime, or represents an interval of time.
237238
238239
Examples
239240
--------
241+
>>> from pandas.tseries.offsets import DateOffset
240242
>>> ts = pd.Timestamp('2017-01-01 09:10:11')
241243
>>> ts + DateOffset(months=3)
242244
Timestamp('2017-04-01 09:10:11')
243245
244246
>>> ts = pd.Timestamp('2017-01-01 09:10:11')
245-
>>> ts + DateOffset(month=3)
247+
>>> ts + DateOffset(months=2)
246248
Timestamp('2017-03-01 09:10:11')
247249
"""
248250

0 commit comments

Comments
 (0)