Closed lgi1sgm closed 2 months ago
('C')
is a str
not a tuple
the correct syntax would be
df.plot(
subplots=[
('A', 'B'),
('C',)
]
)
It works on my side.
Yes ('C')
is still just a string. Closing as the expected behavior
Ah, thats very interesting thank you! I found the corresponding part in the documentation:
A special problem is the construction of tuples containing 0 or 1 items: the syntax has some extra quirks to accommodate these. Empty tuples are constructed by an empty pair of parentheses; a tuple with one item is constructed by following a value with a comma (it is not sufficient to enclose a single value in parentheses). Ugly, but effective. For example:
>>> empty = () >>> singleton = 'hello', # <-- note trailing comma >>> len(empty) 0 >>> len(singleton) 1 >>> singleton >>> ('hello',)
Pandas version checks
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[X] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
The df.plot() command will crash, if it receives tuples in a list as arguments, but the documentation states:
Expected Behavior
do not crash.
Installed Versions