Why does this happen and can anyone tell me if there is a better way to subset the Dates?
Maturity Dates Market Quotes Source Unnamed: 5 Unnamed: 6 Tenor Discount bond price Days0 2013-06-19 99.786 Futures NaN NaN 2013-04-03 NaN 182.01 2013-09-18 99.752 Futures NaN NaN 2013-06-19 NaN 259.02 2013-12-18 99.723 Futures NaN NaN 2013-09-18 NaN 350.03 2014-03-19 99.669 Futures NaN 1 2013-10-03 NaN 365.0Traceback (most recent call last):File "/home/anrdzimin72/pandas1/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3805, in get_locreturn self._engine.get_loc(casted_key)File "index.pyx", line 167, in pandas._libs.index.IndexEngine.get_locFile "index.pyx", line 196, in pandas._libs.index.IndexEngine.get_locFile "pandas/_libs/hashtable_class_helper.pxi", line 7081, in pandas._libs.hashtable.PyObjectHashTable.get_itemFile "pandas/_libs/hashtable_class_helper.pxi", line 7089, in pandas._libs.hashtable.PyObjectHashTable.get_itemKey Error: 'Swap'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):File "/home/anrdzimin72/pandas1/Discount_Curve_Pseudoinverse.py", line 87, in Calendar_S = Calendar[pd.to_numeric(Calendar['Swap'], errors='coerce').notnull()]File "/home/anrdzimin72/pandas1/lib/python3.10/site-packages/pandas/core/frame.py", line 4102, in getitemindexer = self.columns.get_loc(key)File "/home/anrdzimin72/pandas1/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3812, in get_locraise KeyError(key) from errKeyError: 'Swap'The above exception was the direct cause of the following exception:
Traceback (most recent call last):File "/home/anrdzimin72/pandas1/Discount_Curve_Pseudoinverse.py", line 87, in Calendar_S = Calendar[pd.to_numeric(Calendar['Swap'], errors='coerce').notnull()]File "/home/anrdzimin72/pandas1/lib/python3.10/site-packages/pandas/core/frame.py", line 4102, in getitemindexer = self.columns.get_loc(key)File "/home/anrdzimin72/pandas1/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3812, in get_locraise KeyError(key) from errKeyError: 'Swap'
I am trying to subset the Dates and adding the last line of the code Code results in this Error.