File tree 1 file changed +33
-1
lines changed
1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -223,7 +223,7 @@ class Series(base.IndexOpsMixin, generic.NDFrame):
223
223
name : str, optional
224
224
The name to give to the Series.
225
225
copy : bool, default False
226
- Copy input data.
226
+ Copy input data. Only affects Series or 1d ndarray input. See examples.
227
227
228
228
Examples
229
229
--------
@@ -251,6 +251,38 @@ class Series(base.IndexOpsMixin, generic.NDFrame):
251
251
Note that the Index is first build with the keys from the dictionary.
252
252
After this the Series is reindexed with the given Index values, hence we
253
253
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.
254
286
"""
255
287
256
288
_typ = "series"
You can’t perform that action at this time.
0 commit comments