Skip to content

Commit d7705e8

Browse files
attack68znicholls
authored andcommitted
typing refactor (pandas-dev#39812)
Co-authored-by: JHM Darbyshire (MBP) <[email protected]>
1 parent b190231 commit d7705e8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pandas/io/formats/style.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,12 @@ def __init__(
158158
uuid_len: int = 5,
159159
):
160160
# validate ordered args
161-
if not isinstance(data, (pd.Series, pd.DataFrame)):
162-
raise TypeError("``data`` must be a Series or DataFrame")
163-
if data.ndim == 1:
161+
if isinstance(data, pd.Series):
164162
data = data.to_frame()
163+
if not isinstance(data, DataFrame):
164+
raise TypeError("``data`` must be a Series or DataFrame")
165165
if not data.index.is_unique or not data.columns.is_unique:
166166
raise ValueError("style is not supported for non-unique indices.")
167-
assert isinstance(data, DataFrame)
168167
self.data: DataFrame = data
169168
self.index: pd.Index = data.index
170169
self.columns: pd.Index = data.columns

0 commit comments

Comments
 (0)