I have a List in python 3.x as follows:
print_hr()
ATMITMData('Bank Nifty')
print_hr()
print(bn_strikes)
print(tabulate(pd.DataFrame(bn_strikes), headers='keys', tablefmt='psql', showindex=False))
I get the list and the df like this:
List:
{'ATM': 40800, 'ITM': [40700, 40600, 40500], 'OTM': [40900, 41000, 41100]}
DF:
+-------+-------+-------+
| ATM | ITM | OTM |
|-------+-------+-------|
| 40800 | 40700 | 40900 |
| 40800 | 40600 | 41000 |
| 40800 | 40500 | 41100 |
+-------+-------+-------+
My expected output is:
+-------+-------+-------+
| ATM | ITM | OTM |
|-------+-------+-------|
| 40800 | 40700 | 40900 |
| | 40600 | 41000 |
| | 40500 | 41100 |
+-------+-------+-------+
This is what I tried:
print(tabulate(pd.DataFrame(bn_strikes).drop_duplicates(subset=["ATM"]),
headers='keys', tablefmt='psql', showindex=False))
And the output does not match what I want:
+-------+-------+-------+
| ATM | ITM | OTM |
|-------+-------+-------|
| 40800 | 40700 | 40900 |
+-------+-------+-------+