niftynext50_2019[pd.Timestamp(i).day() for i in niftynext50_2019.index[:]]
throws error at ‘for i’.
How can i rectify?
niftynext50_2019[pd.Timestamp(i).day() for i in niftynext50_2019.index[:]]
throws error at ‘for i’.
How can i rectify?
Syntax error:Invalid syntax,
^pointing at “for i”
This is invalid, as the code snippet:
returns an object of type Index
, which can not be traversed as a list.
but,
wd2018=nifty50_2018.groupby([pd.Timestamp(i).dayofweek for i in nifty50_2018.index[:]])
worked?