5

I have a dataframe wich name is "data" with 97230 rows and 4 columns. Name one of columns for example is "A". Also i have some variables: "indVec" - bool series with same index as "data"; valVec - vector with some values. sum(indVec)=len(indVal) I am trying to set value for column 'A' in index "indVec" by different ways. But every time i get this message:

"A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy self._setitem_with_indexer(indexer, value)"

Ways, that i am using to set values for 'A' column of dataframe "data":

  1. data.loc[indVec,'A']=valVec
  2. data.ix[indVec,'A']=valVec
  3. data.set_value[indVec,'A']=valVec
  4. data.A[indVec]=valVec

How can I set value for column 'A' without this message?

EdChum
  • 376,765
  • 198
  • 813
  • 562
K.Alex
  • 161
  • 1
  • 5

0 Answers0