It's really weird but I have tried all the solutions shared here so sharing my main code.
first_df = pd.read_csv(f'C:\\Users\\y\\AlgoTrading\\Algo Live\\Final\\stockpicks\\yy.txt', sep=",",names=['ticker','entry2','entry3','entry4'])
first_df.set_index('ticker',inplace=True)
first_df
Now when I update using the below code and it works fine.
first_df.loc["stock"].entry2 = False
No errors, but when I read 5 columns
first_df = pd.read_csv(f'C:\\Users\\y\\AlgoTrading\\Algo Live\\Final\\stockpicks\\yy.txt', sep=",",names=['ticker','entry2','entry3','entry4','entry5'])
first_df.set_index('ticker',inplace=True)
first_df
Now when I update using the below code and it throws error and doesn't update anything in the dataframe.
first_df.loc["stock"].entry2 = False
this is how the file looks
When 4 - OIL,False,True,True When 5 - SHYAMMETL,True,True,True,2022-12-21 09:55:13.137608
Any help please?
I have tried all the methods I could find, including creating copy and such.