You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now supporting %y (short year), %I (12h clock hour) and %p (AM/PM). Note that the latter is locale-specific... Fixed Period.strftime %l %m and %n : Fixedpandas-dev#46252
Copy file name to clipboardExpand all lines: pandas/_libs/tslibs/strftime.py
+13-14
Original file line number
Diff line number
Diff line change
@@ -7,20 +7,16 @@ class UnsupportedStrFmtDirective(ValueError):
7
7
8
8
9
9
_COMMON_UNSUPPORTED= (
10
-
# All of these below are names and therefore are not in the numpy or datetime attr representation
10
+
# 1- Names not in the numpy or datetime attr representation
11
11
"%a", # Weekday as locale’s abbreviated name.
12
12
"%A", # Weekday as locale’s full name.
13
13
"%w", # Weekday as a decimal number, where 0 is Sunday and 6 is Saturday.
14
14
"%b", # Month as locale’s abbreviated name.
15
15
"%B", # Month as locale’s full name.
16
-
# TODO All of those below can probably be derived easily from the numbers on the instance
17
-
"%y", # Year without century as a zero-padded decimal number. >> year % 100
18
-
"%I", # Hour (12-hour clock) as a zero-padded decimal number. >> hour % 12
19
-
"%p", # Locale’s equivalent of either AM or PM. >> "pm" if (hour // 12) else "am"
20
-
# TODO Below Time offset and timezone information ... but may be hard
21
-
"%z", # UTC offset in the form ±HHMM[SS[.ffffff]] (empty string if the object is naive).
22
-
"%Z", # Time zone name (empty string if the object is naive).
23
-
# We do not want to enter into these below, we do not want to re-create the datetime implementation
16
+
# 2- TODO Below Time offset and timezone information ... but may be hard
17
+
"%z", # UTC offset in the form ±HHMM[SS[.ffffff]] ("" if tz naive).
18
+
"%Z", # Time zone name ("" if tz naive).
19
+
# 3- Probably too complex ones for now
24
20
"%j", # Day of the year as a zero-padded decimal number.
25
21
"%U", # Week number of the year (Sunday as the first day of the week) as a zero-padded decimal number. All days in a new year preceding the first Sunday are considered to be in week 0.
26
22
"%W", # Week number of the year (Monday as the first day of the week) as a zero-padded decimal number. All days in a new year preceding the first Monday are considered to be in week 0.
@@ -34,13 +30,16 @@ class UnsupportedStrFmtDirective(ValueError):
34
30
"%d": ("day", "02d"), # Day of the month as a zero-padded decimal number.
35
31
"%m": ("month", "02d"), # Month as a zero-padded decimal number.
36
32
"%Y": ("year", "d"), # Year with century as a decimal number.
37
-
"%H": ("hour", "02d"), # Hour (24-hour clock) as a zero-padded decimal number.
33
+
"%y": ("shortyear", "02d"), # Year without century as 0-padded decimal nb.
0 commit comments