Description
Feature Type
-
Adding new functionality to pandas
-
Changing existing functionality in pandas
-
Removing existing functionality in pandas
Problem Description
There are a few methods to get a pandas DataFrame from a Pydantic model, but it will be just easier and more readable to not have any intermediate step.
Feature Description
Ideally, I could do something like:
from pydantic import BaseModel
class Item(BaseModel):
item_category: str
item_name: str
purchase_price: float
suggested_retail_price: float
item_number: int
margin: float
note: Optional[str] = None
response = : list[Item]
df = pd.from_pydantic(response)
And I will get a pandas df with columns item_category, item_name, purchase_price, suggested_retail_price, item_number, margin, note
and on each row, one element of the list in response
Alternative Solutions
Additional Context
No response