You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/user_guide/indexing.rst
+14-14
Original file line number
Diff line number
Diff line change
@@ -236,7 +236,7 @@ new column. In 0.21.0 and later, this will raise a ``UserWarning``:
236
236
.. code-block:: ipython
237
237
238
238
In [1]: df = pd.DataFrame({'one': [1., 2., 3.]})
239
-
In [2]: df.two = [4, 5, 6]
239
+
In [2]: df['two'] = [4, 5, 6]
240
240
UserWarning: Pandas doesn't allow Series to be assigned into nonexistent columns - see https://pandas.pydata.org/pandas-docs/stable/indexing.html#attribute_access
241
241
In [3]: df
242
242
Out[3]:
@@ -540,7 +540,7 @@ The ``callable`` must be a function with one argument (the calling Series or Dat
540
540
columns=list('ABCD'))
541
541
df1
542
542
543
-
df1.loc[lambdadf: df.A>0, :]
543
+
df1.loc[lambdadf: df['A']>0, :]
544
544
df1.loc[:, lambdadf: ['A', 'B']]
545
545
546
546
df1.iloc[:, lambdadf: [0, 1]]
@@ -561,7 +561,7 @@ without using a temporary variable.
0 commit comments