@@ -1229,7 +1229,8 @@ def to_perioddelta(self, freq) -> TimedeltaArray:
1229
1229
1230
1230
def month_name (self , locale = None ):
1231
1231
"""
1232
- Return the month names of the DateTimeIndex with specified locale.
1232
+ Return the month names of the :class:`~pandas.Series` or
1233
+ :class:`~pandas.DatetimeIndex` with specified locale.
1233
1234
1234
1235
Parameters
1235
1236
----------
@@ -1239,11 +1240,23 @@ def month_name(self, locale=None):
1239
1240
1240
1241
Returns
1241
1242
-------
1242
- Index
1243
- Index of month names.
1243
+ Series or Index
1244
+ Series or Index of month names.
1244
1245
1245
1246
Examples
1246
1247
--------
1248
+ >>> s = pd.Series(pd.date_range(start='2018-01', freq='M', periods=3))
1249
+ >>> s
1250
+ 0 2018-01-31
1251
+ 1 2018-02-28
1252
+ 2 2018-03-31
1253
+ dtype: datetime64[ns]
1254
+ >>> s.dt.month_name()
1255
+ 0 January
1256
+ 1 February
1257
+ 2 March
1258
+ dtype: object
1259
+
1247
1260
>>> idx = pd.date_range(start='2018-01', freq='M', periods=3)
1248
1261
>>> idx
1249
1262
DatetimeIndex(['2018-01-31', '2018-02-28', '2018-03-31'],
@@ -1259,7 +1272,8 @@ def month_name(self, locale=None):
1259
1272
1260
1273
def day_name (self , locale = None ):
1261
1274
"""
1262
- Return the day names of the DateTimeIndex with specified locale.
1275
+ Return the day names of the :class:`~pandas.Series` or
1276
+ :class:`~pandas.DatetimeIndex` with specified locale.
1263
1277
1264
1278
Parameters
1265
1279
----------
@@ -1269,11 +1283,23 @@ def day_name(self, locale=None):
1269
1283
1270
1284
Returns
1271
1285
-------
1272
- Index
1273
- Index of day names.
1286
+ Series or Index
1287
+ Series or Index of day names.
1274
1288
1275
1289
Examples
1276
1290
--------
1291
+ >>> s = pd.Series(pd.date_range(start='2018-01-01', freq='D', periods=3))
1292
+ >>> s
1293
+ 0 2018-01-01
1294
+ 1 2018-01-02
1295
+ 2 2018-01-03
1296
+ dtype: datetime64[ns]
1297
+ >>> s.dt.day_name()
1298
+ 0 Monday
1299
+ 1 Tuesday
1300
+ 2 Wednesday
1301
+ dtype: object
1302
+
1277
1303
>>> idx = pd.date_range(start='2018-01-01', freq='D', periods=3)
1278
1304
>>> idx
1279
1305
DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03'],
0 commit comments