-
Book Overview & Buying
-
Table Of Contents
Python Real-World Projects
By :
Here are some ideas for you to add to this project.
The pandas package offers a robust set of tools for doing data analysis. The core concept is to create a DataFrame that contains the relevant samples. The pandas package needs to be installed and added to the requirements.txt file.
There are methods for transforming a sequence of SeriesSample objects into a DataFrame. The best approach is often to convert each of the pydantic objects into a dictionary, and build the dataframe from the list of dictionaries.
The idea is something like the following:
import pandas as pd df = pd.DataFrame([dict(s) for s in series_data])
In this example, the value of series_data is a sequence of SeriesSample instances.
Each column in the resulting dataframe will be one of the variables of the sample. Given this object, methods of the DataFrame object produce useful statistics.
The corr() function, for example, computes the correlation values...