Skip to content

Commit 3cc7fac

Browse files
author
Sylvain MARIE
committed
Added comments and removed useless variable declaration
1 parent 48d5159 commit 3cc7fac

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pandas/_libs/tslibs/period.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1243,17 +1243,21 @@ cdef str _period_strftime(int64_t value, int freq, bytes fmt):
12431243
char *formatted
12441244
bytes pat, brepl
12451245
list found_pat = [False] * len(extra_fmts)
1246-
int year, quarter
1246+
int quarter
12471247
str result, repl
12481248

12491249
get_date_info(value, freq, &dts)
1250+
1251+
# Find our additional directives in the pattern and replace them with
1252+
# placeholders that are not processed by c_strftime
12501253
for i in range(len(extra_fmts)):
12511254
pat = extra_fmts[i][0]
12521255
brepl = extra_fmts[i][1]
12531256
if pat in fmt:
12541257
fmt = fmt.replace(pat, brepl)
12551258
found_pat[i] = True
12561259

1260+
# Execute c_strftime to process the usual datetime directives
12571261
formatted = c_strftime(&dts, <char*>fmt)
12581262

12591263
result = util.char_to_string(formatted)

0 commit comments

Comments
 (0)