Hello, I am getting the following error while placing a stop loss order using the python client. KeyError: 'TATAMOTORS'
Kindly note, eventhough an error occurs, the order is successfully placed.
The following is the error details: File "C:\Users\WN998UR\AppData\Local\Temp/ipykernel_20324/761466687.py", line 208, in placeOrder self.st_dir[symbol]["entryOrderno"] =self.kite.place_order(tradingsymbol=symbol,
File "C:\Users\WN998UR\Anaconda3\envs\algo\lib\site-packages\pandas\core\frame.py", line 3458, in __getitem__ indexer = self.columns.get_loc(key)
This annoying error means that Pandas can not find your column name in your dataframe. Before doing anything with the data frame, use print(df.columns) to see dataframe column exist or not.
print(df.columns)
I was getting a similar kind of error in one of my codes. Turns out, that particular index was missing from my data frame as I had dropped the empty dataframe 2 rows. If this is the case, you can do df.reset_index(inplace=True) and the error should be resolved.
print(df.columns)
I was getting a similar kind of error in one of my codes. Turns out, that particular index was missing from my data frame as I had dropped the empty dataframe 2 rows. If this is the case, you can do df.reset_index(inplace=True) and the error should be resolved.