We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b176418 commit 52d9bb9Copy full SHA for 52d9bb9
pandas/io/formats/style.py
@@ -158,13 +158,12 @@ def __init__(
158
uuid_len: int = 5,
159
):
160
# 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:
+ if isinstance(data, pd.Series):
164
data = data.to_frame()
+ if not isinstance(data, DataFrame):
+ raise TypeError("``data`` must be a Series or DataFrame")
165
if not data.index.is_unique or not data.columns.is_unique:
166
raise ValueError("style is not supported for non-unique indices.")
167
- assert isinstance(data, DataFrame)
168
self.data: DataFrame = data
169
self.index: pd.Index = data.index
170
self.columns: pd.Index = data.columns
0 commit comments