I am new to pandas so I am having trouble with the indexing when writing this loop for my assignment:

```
quality = wine_data_all['quality']
for i in range(1,len(quality.index)): if quality[i] == 6 | quality[i] ==5:
     quality[i] = 1;
wine_data_all.replace['quality',quality]

```

my intention is to switch all the values that are 6 and 5 in the quality column of wine\_data\_all with 1 and then swap the new replaced column in for quality. If i can do this without creating a new quality and simply editing the wine\_data\_all it will also work but I ran into even more problems when trying to index directly out of the data frame.

The error I am getting is:

```
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [150], in <cell line: 2>()
      1 quality = wine_data_all['quality']
      2 for i in range(1,len(quality.index)):
----> 5     if quality[i] == 6 | quality[i] ==5:
      7         quality[i] = 0;
     11 print(quality)

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\generic.py:1527, in NDFrame.__nonzero__(self)
   1525 @final
   1526 def __nonzero__(self):
-> 1527     raise ValueError(
   1528         f"The truth value of a {type(self).__name__} is ambiguous. "
   1529         "Use a.empty, a.bool(), a.item(), a.any() or a.all()."
   1530     )

ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

```

Any help is appreciated.