@@ -793,17 +793,27 @@ def month_name(self, locale=None):
793
793
"""
794
794
Return the month names of the DateTimeIndex with specified locale.
795
795
796
+ .. versionadded:: 0.23.0
797
+
796
798
Parameters
797
799
----------
798
- locale : string, default None (English locale)
799
- locale determining the language in which to return the month name
800
+ locale : str, optional
801
+ Locale determining the language in which to return the month name.
802
+ Default is English locale.
800
803
801
804
Returns
802
805
-------
803
- month_names : Index
804
- Index of month names
806
+ Index
807
+ Index of month names.
805
808
806
- .. versionadded:: 0.23.0
809
+ Examples
810
+ --------
811
+ >>> idx = pd.DatetimeIndex(start='2018-01', freq='M', periods=3)
812
+ >>> idx
813
+ DatetimeIndex(['2018-01-31', '2018-02-28', '2018-03-31'],
814
+ dtype='datetime64[ns]', freq='M')
815
+ >>> idx.month_name()
816
+ Index(['January', 'February', 'March'], dtype='object')
807
817
"""
808
818
if self .tz is not None and self .tz is not utc :
809
819
values = self ._local_timestamps ()
@@ -819,17 +829,27 @@ def day_name(self, locale=None):
819
829
"""
820
830
Return the day names of the DateTimeIndex with specified locale.
821
831
832
+ .. versionadded:: 0.23.0
833
+
822
834
Parameters
823
835
----------
824
- locale : string, default None (English locale)
825
- locale determining the language in which to return the day name
836
+ locale : str, optional
837
+ Locale determining the language in which to return the day name.
838
+ Default is English locale.
826
839
827
840
Returns
828
841
-------
829
- month_names : Index
830
- Index of day names
842
+ Index
843
+ Index of day names.
831
844
832
- .. versionadded:: 0.23.0
845
+ Examples
846
+ --------
847
+ >>> idx = pd.DatetimeIndex(start='2018-01-01', freq='D', periods=3)
848
+ >>> idx
849
+ DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03'],
850
+ dtype='datetime64[ns]', freq='D')
851
+ >>> idx.day_name()
852
+ Index(['Monday', 'Tuesday', 'Wednesday'], dtype='object')
833
853
"""
834
854
if self .tz is not None and self .tz is not utc :
835
855
values = self ._local_timestamps ()
0 commit comments