I am trying to read data from csv and compare value from ‘Sentiment’ column against
df1 = pd.read_csv('C:\\Python\\hack\\customer_reviews_further_analysis3.csv')
df2 = pd.read_csv('C:\\Python\\hack\\Bank_Offers_data.csv')
cols = ['CustomerRating','CustomerFeedback', 'Sentiment','Bank','Card','TravelnHotel','Rewards','Lifestyle','Charge']
quotes=[]
if ((df1.Sentiment == 1) | (df1.Sentiment == 4)):
if((df1.CustomerRating == 5) | (df1.CustomerRating == 4)):
while((df1.TravelnHotel == df2.TravelnHotel) & (df1.Rewards == df2.Rewards) & (df1.Lifestyle == df2.Lifestyle) & (df1.Charge == df2.Charge)):
continue
quotes.append(df1['Sentiment','Bank','Card','TravelnHotel','Rewards','Lifestyle','Charge'])
Error:
runfile('C:/Python/ProductComparison_10Dec.py', wdir='C:/Python')
Traceback (most recent call last):
File "C:\Python\ProductComparison_10Dec.py", line 29, in <module>
if ((df1.Sentiment == 1) | (df1.Sentiment == 4)):
File "C:\Users\176226\Anaconda3\lib\site-packages\pandas\core\generic.py", line 1479, in __nonzero__
f"The truth value of a {type(self).__name__} is ambiguous. "
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Referred previous solution on: Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all() However this did not help