Skip to content

Commit daf33a9

Browse files
Added single quotes for number format
1 parent 3d1abe7 commit daf33a9

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

pandas/io/formats/css.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,21 @@
2121

2222

2323
def _normalize_number_format_value(value: str) -> str:
24-
value = value.strip()
25-
out: list[str] = []
26-
in_string = False
24+
out = []
25+
in_single = False
26+
in_double = False
2727

28-
for ch in value:
29-
if ch == '"':
28+
for ch in value.strip():
29+
if ch == "'" and not in_double:
30+
in_single = not in_single
31+
out.append(ch)
32+
elif ch == '"' and not in_single:
33+
in_double = not in_double
34+
out.append(ch)
35+
elif in_single or in_double:
3036
out.append(ch)
31-
in_string = not in_string
32-
elif in_string:
33-
out.append(ch) # preserve case inside string literals
3437
else:
35-
out.append(ch.lower()) # normalize outside literals
38+
out.append(ch.lower())
3639
return "".join(out)
3740

3841

0 commit comments

Comments
 (0)