Add toml to dev deps, fix to_df() edge case

This commit is contained in:
Igor Radovanovic
2023-09-30 16:58:28 +02:00
parent 45a1241849
commit 16e94db6d1
2 changed files with 7 additions and 10 deletions

View File

@@ -1,14 +1,6 @@
"""The OBBject."""
from re import sub
from typing import (
Any,
Dict,
Generic,
List,
Literal,
Optional,
TypeVar,
)
from typing import Any, Dict, Generic, List, Literal, Optional, TypeVar
import pandas as pd
from numpy import ndarray
@@ -147,7 +139,11 @@ class OBBject(Tagged, Generic[T]):
sort_columns = False
# List[List | str | int | float] | Dict[str, Dict | List | BaseModel]
else:
df = pd.DataFrame(res)
try:
df = pd.DataFrame(res)
except ValueError:
if isinstance(res, dict):
df = pd.DataFrame([res])
if df is None:
raise OpenBBError("Unsupported data format.")

View File

@@ -62,6 +62,7 @@ all = [
pytest = "^7.0.0"
pytest-subtests = "^0.11.0"
pytest-recorder = "^0.2.3"
toml = "^0.10.2"
[build-system]
requires = ["poetry-core"]