Book Image

Python Real-World Projects

By : Steven F. Lott
5 (1)
Book Image

Python Real-World Projects

5 (1)
By: Steven F. Lott

Overview of this book

In today's competitive job market, a project portfolio often outshines a traditional resume. Python Real-World Projects empowers you to get to grips with crucial Python concepts while building complete modules and applications. With two dozen meticulously designed projects to explore, this book will help you showcase your Python mastery and refine your skills. Tailored for beginners with a foundational understanding of class definitions, module creation, and Python's inherent data structures, this book is your gateway to programming excellence. You’ll learn how to harness the potential of the standard library and key external projects like JupyterLab, Pydantic, pytest, and requests. You’ll also gain experience with enterprise-oriented methodologies, including unit and acceptance testing, and an agile development approach. Additionally, you’ll dive into the software development lifecycle, starting with a minimum viable product and seamlessly expanding it to add innovative features. By the end of this book, you’ll be armed with a myriad of practical Python projects and all set to accelerate your career as a Python programmer.
Table of Contents (20 chapters)
19
Index

16.5 Extras

Here are some ideas for you to add to this project.

16.5.1 Use pandas to compute basic statistics

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...