Skip to content

Commit 52ce3ba

Browse files
committed
DOC: Add reworded parameter info and and 2 examples again (#41423).
Remove whitespace on blank lines and line break sentences to avoid style errors. Previous commit had 1 failing check.
1 parent dfd10c8 commit 52ce3ba

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

pandas/core/series.py

+33-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class Series(base.IndexOpsMixin, generic.NDFrame):
223223
name : str, optional
224224
The name to give to the Series.
225225
copy : bool, default False
226-
Copy input data.
226+
Copy input data. Only affects Series or 1d ndarray input. See examples.
227227
228228
Examples
229229
--------
@@ -251,6 +251,38 @@ class Series(base.IndexOpsMixin, generic.NDFrame):
251251
Note that the Index is first build with the keys from the dictionary.
252252
After this the Series is reindexed with the given Index values, hence we
253253
get all NaN as a result.
254+
255+
Constructing Series from a list with `copy=False`.
256+
257+
>>> r = [1, 2]
258+
>>> ser = pd.Series(r, copy=False)
259+
>>> ser.iloc[0] = 999
260+
>>> r
261+
[1, 2]
262+
>>> ser
263+
0 999
264+
1 2
265+
dtype: int64
266+
267+
Due to input data type the Series has a `copy` of
268+
the original data even though `copy=False`, so
269+
the data is unchanged.
270+
271+
Constructing Series from a 1d ndarray with `copy=False`.
272+
273+
>>> r = np.array([1, 2])
274+
>>> ser = pd.Series(r, copy=False)
275+
>>> ser.iloc[0] = 999
276+
>>> r
277+
array([999, 2])
278+
>>> ser
279+
0 999
280+
1 2
281+
dtype: int32
282+
283+
Due to input data type the Series has a `view` on
284+
the original data, so
285+
the data is changed as well.
254286
"""
255287

256288
_typ = "series"

0 commit comments

Comments
 (0)