@@ -1217,7 +1217,8 @@ def to_perioddelta(self, freq) -> TimedeltaArray:
1217
1217
1218
1218
def month_name (self , locale = None ):
1219
1219
"""
1220
- Return the month names of the DateTimeIndex with specified locale.
1220
+ Return the month names of the :class:`~pandas.Series` or
1221
+ :class:`~pandas.DatetimeIndex` with specified locale.
1221
1222
1222
1223
Parameters
1223
1224
----------
@@ -1227,11 +1228,23 @@ def month_name(self, locale=None):
1227
1228
1228
1229
Returns
1229
1230
-------
1230
- Index
1231
- Index of month names.
1231
+ Series or Index
1232
+ Series or Index of month names.
1232
1233
1233
1234
Examples
1234
1235
--------
1236
+ >>> s = pd.Series(pd.date_range(start='2018-01', freq='M', periods=3))
1237
+ >>> s
1238
+ 0 2018-01-31
1239
+ 1 2018-02-28
1240
+ 2 2018-03-31
1241
+ dtype: datetime64[ns]
1242
+ >>> s.dt.month_name()
1243
+ 0 January
1244
+ 1 February
1245
+ 2 March
1246
+ dtype: object
1247
+
1235
1248
>>> idx = pd.date_range(start='2018-01', freq='M', periods=3)
1236
1249
>>> idx
1237
1250
DatetimeIndex(['2018-01-31', '2018-02-28', '2018-03-31'],
@@ -1247,7 +1260,8 @@ def month_name(self, locale=None):
1247
1260
1248
1261
def day_name (self , locale = None ):
1249
1262
"""
1250
- Return the day names of the DateTimeIndex with specified locale.
1263
+ Return the day names of the :class:`~pandas.Series` or
1264
+ :class:`~pandas.DatetimeIndex` with specified locale.
1251
1265
1252
1266
Parameters
1253
1267
----------
@@ -1257,11 +1271,23 @@ def day_name(self, locale=None):
1257
1271
1258
1272
Returns
1259
1273
-------
1260
- Index
1261
- Index of day names.
1274
+ Series or Index
1275
+ Series or Index of day names.
1262
1276
1263
1277
Examples
1264
1278
--------
1279
+ >>> s = pd.Series(pd.date_range(start='2018-01-01', freq='D', periods=3))
1280
+ >>> s
1281
+ 0 2018-01-01
1282
+ 1 2018-01-02
1283
+ 2 2018-01-03
1284
+ dtype: datetime64[ns]
1285
+ >>> s.dt.day_name()
1286
+ 0 Monday
1287
+ 1 Tuesday
1288
+ 2 Wednesday
1289
+ dtype: object
1290
+
1265
1291
>>> idx = pd.date_range(start='2018-01-01', freq='D', periods=3)
1266
1292
>>> idx
1267
1293
DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03'],
0 commit comments