Skip to content

Commit

Permalink
ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
mattijn committed Mar 25, 2024
1 parent 8b41305 commit 62ab14d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions altair/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,10 @@ def to_values(data: DataType) -> ToValuesReturnType:


def check_data_type(data: DataType) -> None:
if not isinstance(data, (dict, DataFrameLike)) and not _is_pandas_dataframe(data) and not any(
hasattr(data, attr) for attr in ["__geo_interface__"]
if (
not isinstance(data, (dict, DataFrameLike))
and not _is_pandas_dataframe(data)
and not any(hasattr(data, attr) for attr in ["__geo_interface__"])
):
raise TypeError(
"Expected dict, DataFrame or a __geo_interface__ attribute, got: {}".format(
Expand Down Expand Up @@ -299,6 +301,7 @@ def _data_to_csv_string(data: Union[dict, DataFrameLike, "pd.DataFrame"]) -> str
return data.to_csv(index=False)
elif isinstance(data, dict):
from altair.utils._importers import import_pandas

if "values" not in data:
raise KeyError("values expected in data dict, but not present")
pd = import_pandas()
Expand Down

0 comments on commit 62ab14d

Please sign in to comment.