Skip to content

TYP: remove inappropriate use of cast #34990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pandas/io/formats/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,15 +588,14 @@ def __init__(
elif isinstance(col_space, (int, str)):
self.col_space = {"": col_space}
self.col_space.update({column: col_space for column in self.frame.columns})
elif isinstance(col_space, dict):
elif isinstance(col_space, Mapping):
for column in col_space.keys():
if column not in self.frame.columns and column != "":
raise ValueError(
f"Col_space is defined for an unknown column: {column}"
)
self.col_space = col_space
else:
col_space = cast(Sequence, col_space)
if len(frame.columns) != len(col_space):
raise ValueError(
f"Col_space length({len(col_space)}) should match "
Expand Down