This question is a followup from here: How to disable Python warnings? I have the following code:
from prettytable import PrettyTable
import operator
import calendar
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
warnings.filterwarnings("ignore", category=FutureWarning)
import pandas as pd, datetime, calendar
...
{rest of my code}
I am trying to suppress these warning:
<ipython-input-3-7e458c7b53b6>:22: FutureWarning: weekofyear and week have been deprecated, please use DatetimeIndex.isocalendar().week instead, which returns a Series. To exactly reproduce the behavior of week and weekofyear and return an Index, you may call pd.Int64Index(idx.isocalendar().week)
data['week'] = data.index.week
For some reason this is not ignoring these warnings. I am trying to ignore the warning of just in pandas where they are originating from and not the warning which i may get from other packages. Could you please advise as to why this is not working?