0

This is what I had tried:

dates = pd.date_range('10-01-2016', periods=9, freq='2W-SUN')
df = pd.DataFrame({'Count 1': 100 + np.random.randint(-5, 10, 9).cumsum(),
                  'Count 2': 120 + np.random.randint(-5, 10, 9)}, index=dates)
df

To display weekday name:

df.index.weekday_name

But I've got

 AttributeError: 'DatetimeIndex' object has no attribute 'weekday_name'

Expected output:

Index(['Sunday', 'Sunday', 'Sunday', 'Sunday', 'Sunday', 'Sunday', 'Sunday',
       'Sunday', 'Sunday'],
      dtype='object')

Help me to solve this issue. Thank you in advance.

0 Answers0