Skip to content

Commit eec0313

Browse files
committed
docs & lint
1 parent 14e689d commit eec0313

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

doc/source/user_guide/reshaping.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -818,36 +818,35 @@ Sometimes the value column is list-like.
818818
df = pd.DataFrame({'keys': keys, 'values': values})
819819
df
820820
821-
We can 'explode' this transforming each element of a list-like to a row, by using ``~Series.explode``. This will replicate the index values:
821+
We can 'explode' this transforming each element of a list-like to a row, by using :meth:`~Series.explode`. This will replicate the index values:
822822

823823
.. ipython:: python
824824
825825
df['values'].explode()
826826
827-
You can join this with the original to get an expanded ``DataFrame``.
827+
You can easily join this with the original to get an expanded ``DataFrame``.
828828

829829
.. ipython:: python
830830
831831
df[['keys']].join(df['values'].explode())
832832
833-
834-
This routine will replace empty lists with ``np.nan`` and preserve scalar entries. The dtype of the resulting ``Series`` is always ``object``.
833+
:meth:`Series.explode` will replace empty lists with ``np.nan`` and preserve scalar entries. The dtype of the resulting ``Series`` is always ``object``.
835834

836835
.. ipython:: python
837836
838837
s = pd.Series([[1, 2, 3], 'foo', [], ['a', 'b']])
839838
s
840839
s.explode()
841840
842-
Here is a typical usecase. You have comma separated string in a column.
841+
Here is a typical usecase. You have comma separated strings in a column and want to expand this.
843842

844843
.. ipython:: python
845844
846-
df = DataFrame([{'var1': 'a,b,c', 'var2': 1},
847-
{'var1': 'd,e,f', 'var2': 2}])
845+
df = pd.DataFrame([{'var1': 'a,b,c', 'var2': 1},
846+
{'var1': 'd,e,f', 'var2': 2}])
848847
df
849848
850-
Creating a long form DataFrame is now straightforward using chained operations
849+
Creating a long form DataFrame is now straightforward using explode and chained operations
851850

852851
.. ipython:: python
853852

doc/source/whatsnew/v0.25.0.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,17 +200,17 @@ Here is a typical usecase. You have comma separated string in a column.
200200

201201
.. ipython:: python
202202
203-
df = DataFrame([{'var1': 'a,b,c', 'var2': 1},
204-
{'var1': 'd,e,f', 'var2': 2}])
203+
df = pd.DataFrame([{'var1': 'a,b,c', 'var2': 1},
204+
{'var1': 'd,e,f', 'var2': 2}])
205205
df
206206
207-
Creating a long form DataFrame is now straightforward using chained operations
207+
Creating a long form ``DataFrame`` is now straightforward using chained operations
208208

209209
.. ipython:: python
210210
211-
exploded = df.var1.str.split(',').explode()
212-
exploded
213-
df[['var2']].join(exploded)
211+
exploded = df.var1.str.split(',').explode()
212+
exploded
213+
df[['var2']].join(exploded)
214214
215215
.. _whatsnew_0250.enhancements.other:
216216

pandas/_libs/lib.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,6 @@ def is_list_like(obj: object, allow_sets: bool = True):
929929
return c_is_list_like(obj, allow_sets)
930930

931931

932-
933932
cdef inline bint c_is_list_like(object obj, bint allow_sets):
934933
return (
935934
isinstance(obj, abc.Iterable)

0 commit comments

Comments
 (0)