Custom Python Classes for Generating Statistical Insights from Data
In computer programming, a class is a blueprint for a user-defined data type. Classes are defined in terms of attributes (data) and methods (functions). These data structures are a great way to organize data and methods such that they are easy to reuse and extend in the future. In this post, we will define a python class that will allow us to generate simple summary statistics and perform some EDA on data.
Let’s get started!
For our purposes we will be working with the_ FIFA 19_ data set which can be found here.
To start, let’s import the pandas package:
import pandas as pd
Next, let’s set the maximum number of display columns and rows to ‘None’:
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
Now, let’s read in our data:
df = pd.read_csv('fifa_data.csv')
Next we will print the first five rows of data to get an idea of the column types and their values (column results are truncated):
print(df.head())
🔵 Intellipaat Data Science with Python course: https://intellipaat.com/python-for-data-science-training/In this Data Science With Python Training video, you...
Enroll in our Data Science with Python training in Chennai. Best Data Science with Python Training courses in Chennai for 100% Job Placements Support.
🔥Intellipaat Python for Data Science Course: https://intellipaat.com/python-for-data-science-training/In this python for data science video you will learn e...
Master Applied Data Science with Python and get noticed by the top Hiring Companies with IgmGuru's Data Science with Python Certification Program. Enroll Now
Find out here. Although data science job descriptions require a range of various skillsets, there are concrete prerequisites that can help you to become a successful data scientist. Some of those skills include, but are not limited to: communication, statistics, organization, and lastly, programming. Programming can be quite vague, for example, some companies in an interview could ask for a data scientist to code in Python a common pandas’ functions, while other companies can require a complete take on software engineering with classes.