@@ -771,17 +771,27 @@ def month_name(self, locale=None):
771
771
"""
772
772
Return the month names of the DateTimeIndex with specified locale.
773
773
774
+ .. versionadded:: 0.23.0
775
+
774
776
Parameters
775
777
----------
776
- locale : string, default None (English locale)
777
- locale determining the language in which to return the month name
778
+ locale : str, optional
779
+ Locale determining the language in which to return the month name.
780
+ Default is English locale.
778
781
779
782
Returns
780
783
-------
781
- month_names : Index
782
- Index of month names
784
+ Index
785
+ Index of month names.
783
786
784
- .. versionadded:: 0.23.0
787
+ Examples
788
+ --------
789
+ >>> idx = pd.DatetimeIndex(start='2018-01', freq='M', periods=3)
790
+ >>> idx
791
+ DatetimeIndex(['2018-01-31', '2018-02-28', '2018-03-31'],
792
+ dtype='datetime64[ns]', freq='M')
793
+ >>> idx.month_name()
794
+ Index(['January', 'February', 'March'], dtype='object')
785
795
"""
786
796
if self .tz is not None and self .tz is not utc :
787
797
values = self ._local_timestamps ()
@@ -797,17 +807,27 @@ def day_name(self, locale=None):
797
807
"""
798
808
Return the day names of the DateTimeIndex with specified locale.
799
809
810
+ .. versionadded:: 0.23.0
811
+
800
812
Parameters
801
813
----------
802
- locale : string, default None (English locale)
803
- locale determining the language in which to return the day name
814
+ locale : str, optional
815
+ Locale determining the language in which to return the day name.
816
+ Default is English locale.
804
817
805
818
Returns
806
819
-------
807
- month_names : Index
808
- Index of day names
820
+ Index
821
+ Index of day names.
809
822
810
- .. versionadded:: 0.23.0
823
+ Examples
824
+ --------
825
+ >>> idx = pd.DatetimeIndex(start='2018-01-01', freq='D', periods=3)
826
+ >>> idx
827
+ DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03'],
828
+ dtype='datetime64[ns]', freq='D')
829
+ >>> idx.day_name()
830
+ Index(['Monday', 'Tuesday', 'Wednesday'], dtype='object')
811
831
"""
812
832
if self .tz is not None and self .tz is not utc :
813
833
values = self ._local_timestamps ()
0 commit comments