modin.pandas.DatetimeIndex.month_name¶
- DatetimeIndex.month_name(locale: str = None) Index [source]¶
Return the month names with specified locale.
- Parameters:
locale (str, optional) – Locale determining the language in which to return the month name. Default is English locale (
'en_US.utf8'
). Use the commandlocale -a
on your terminal on Unix systems to find your locale language code.- Return type:
Index of month names.
Examples
>>> idx = pd.date_range(start='2018-01', freq='ME', periods=3) >>> idx DatetimeIndex(['2018-01-31', '2018-02-28', '2018-03-31'], dtype='datetime64[ns]', freq=None) >>> idx.month_name() Index(['January', 'February', 'March'], dtype='object')
Using the
locale
parameter you can set a different locale language, for example:idx.month_name(locale='pt_BR.utf8')
will return month names in Brazilian Portuguese language.>>> idx = pd.date_range(start='2018-01', freq='ME', periods=3) >>> idx DatetimeIndex(['2018-01-31', '2018-02-28', '2018-03-31'], dtype='datetime64[ns]', freq=None) >>> idx.month_name(locale='pt_BR.utf8') Index(['Janeiro', 'Fevereiro', 'Março'], dtype='object')