Show Menu
Cheatography

Data Analytics Cheat Sheet by

Pandas, Matplot syntax

Useful Imports

Importing Pandas
import pandas as pd
Importing Matplot
import matplo­tli­b.p­yplot as plt
For Checking Data Type
from pandas.ap­i.types import is_num­eri­c_dtype
Plotting Parallel Coordi­nates
from pandas.pl­otting import parall­el_­coo­rdi­nates

Column Data Type Manipu­lation

Changing All Columns
data.a­sty­pe(­'in­t64­').d­types
Changing Selected Column
data.a­stype( {'col1': 'int64'} ).dtypes
 

Basic Stuff

Reading CSV
data = pd.rea­d_c­sv(­'ch­ang­eme.csv', header­=None)
Assigning Column Names
data.c­olumns = ['colu­mn1', 'column2', 'class']
Checking Column Data Type
data.d­types
Listing the Dataset
data

Plotting

Line Graph
plt.pl­ot(­data.x, data.y, 'o')
Boxplot
data.b­oxp­lot­(co­lum­n=[­'col1', 'col2', 'col3']
Histogram
data['­col­1'].hi­st(­bin­s=20)
Parallel Coordi­nates
parall­el_­coo­rdi­nat­es(­nut­rie­nt_csv, 'Class­Col', cols = ['col1', 'col2'])
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets