Skip to content

Commit dc17ef6

Browse files
committed
lint
1 parent 5512e29 commit dc17ef6

File tree

2 files changed

+33
-25
lines changed

2 files changed

+33
-25
lines changed

pandas/core/frame.py

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6250,7 +6250,8 @@ def explode(self, subset: Iterable) -> "DataFrame":
62506250
Returns
62516251
-------
62526252
DataFrame
6253-
Exploded lists to rows of the subset columns; index will be duplicated for these rows.
6253+
Exploded lists to rows of the subset columns;
6254+
index will be duplicated for these rows.
62546255
62556256
Raises
62566257
------
@@ -6261,32 +6262,39 @@ def explode(self, subset: Iterable) -> "DataFrame":
62616262
62626263
See Also
62636264
--------
6264-
Series.str.split : Split string values on specified separator.
6265-
Series.unstack : Unstack, a.k.a. pivot, Series with MultiIndex to produce DataFrame.
6265+
DataFrame.unstack : Pivot a level of the (necessarily hierarchical)
6266+
index labels
62666267
DataFrame.melt : Unpivot a DataFrame from wide format to long format
62676268
Series.explode : Explode a DataFrame from list-like columns to long format.
62686269
62696270
Notes
62706271
-----
6271-
This routine will explode list-likes including lists, tuples, Series, and np.ndarray.
6272+
This routine will explode list-likes including lists, tuples,
6273+
Series, and np.ndarray.
62726274
The result dtype of the subset rows will be object.
62736275
Scalars will be returned unchanged.
62746276
Empty list-likes will result in a np.nan for that row.
62756277
62766278
Examples
62776279
--------
6278-
In [1]: df = pd.DataFrame({'A': [[1, 2, 3], 'foo', [], [3, 4]], 'B': 1})
6279-
6280-
In [3]: df.explode()
6281-
Out[3]:
6282-
0 1
6283-
0 2
6284-
0 3
6285-
1 foo
6286-
2 NaN
6287-
3 3
6288-
3 4
6289-
dtype: object
6280+
>>> df = pd.DataFrame({'A': [[1, 2, 3], 'foo', [], [3, 4]], 'B': 1})
6281+
>>> df
6282+
A B
6283+
0 [1, 2, 3] 1
6284+
1 foo 1
6285+
2 [] 1
6286+
3 [3, 4] 1
6287+
6288+
>>> df.explode(['A'])
6289+
A B
6290+
0 1 1
6291+
0 2 1
6292+
0 3 1
6293+
1 foo 1
6294+
2 NaN 1
6295+
3 3 1
6296+
3 4 1
6297+
62906298
"""
62916299

62926300
if not is_list_like(subset):

pandas/core/series.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3650,31 +3650,31 @@ def explode(self) -> "Series":
36503650
See Also
36513651
--------
36523652
Series.str.split : Split string values on specified separator.
3653-
Series.unstack : Unstack, a.k.a. pivot, Series with MultiIndex to produce DataFrame.
3653+
Series.unstack : Unstack, a.k.a. pivot, Series with MultiIndex
3654+
to produce DataFrame.
36543655
DataFrame.melt : Unpivot a DataFrame from wide format to long format
3655-
DataFrame.explode : Explode a DataFrame from list-like columns to long format.
3656+
DataFrame.explode : Explode a DataFrame from list-like
3657+
columns to long format.
36563658
36573659
Notes
36583660
-----
3659-
This routine will explode list-likes including lists, tuples, Series, and np.ndarray.
3661+
This routine will explode list-likes including lists, tuples,
3662+
Series, and np.ndarray.
36603663
The result dtype of the returned Series will always be object.
36613664
Scalars will be returned unchanged.
36623665
Empty list-likes will result in a np.nan for that row.
36633666
36643667
Examples
36653668
--------
3666-
In [1]: s = pd.Series([[1, 2, 3], 'foo', [], [3, 4]])
3667-
3668-
In [2]: s
3669-
Out[2]:
3669+
>>> s = pd.Series([[1, 2, 3], 'foo', [], [3, 4]])
3670+
>>> s
36703671
0 [1, 2, 3]
36713672
1 foo
36723673
2 []
36733674
3 [3, 4]
36743675
dtype: object
36753676
3676-
In [3]: s.explode()
3677-
Out[3]:
3677+
>>> s.explode()
36783678
0 1
36793679
0 2
36803680
0 3

0 commit comments

Comments
 (0)