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 @@ -224,7 +224,7 @@ class Series(base.IndexOpsMixin, generic.NDFrame):
224
224
name : str, optional
225
225
The name to give to the Series.
226
226
copy : bool, default False
227
- Copy input data.
227
+ Copy input data. Only affects Series or 1d ndarray input. See examples.
228
228
229
229
Examples
230
230
--------
@@ -252,6 +252,38 @@ class Series(base.IndexOpsMixin, generic.NDFrame):
252
252
Note that the Index is first build with the keys from the dictionary.
253
253
After this the Series is reindexed with the given Index values, hence we
254
254
get all NaN as a result.
255
+
256
+ Constructing Series from a list with `copy=False`.
257
+
258
+ >>> r = [1, 2]
259
+ >>> ser = pd.Series(r, copy=False)
260
+ >>> ser.iloc[0] = 999
261
+ >>> r
262
+ [1, 2]
263
+ >>> ser
264
+ 0 999
265
+ 1 2
266
+ dtype: int64
267
+
268
+ Due to input data type the Series has a `copy` of
269
+ the original data even though `copy=False`, so
270
+ the data is unchanged.
271
+
272
+ Constructing Series from a 1d ndarray with `copy=False`.
273
+
274
+ >>> r = np.array([1, 2])
275
+ >>> ser = pd.Series(r, copy=False)
276
+ >>> ser.iloc[0] = 999
277
+ >>> r
278
+ array([999, 2])
279
+ >>> ser
280
+ 0 999
281
+ 1 2
282
+ dtype: int64
283
+
284
+ Due to input data type the Series has a `view` on
285
+ the original data, so
286
+ the data is changed as well.
255
287
"""
256
288
257
289
_typ = "series"
You can’t perform that action at this time.
0 commit comments