Skip to content

Introduction to Data Science in Python

Run the hidden code cell below to import the data used in this course.

Getting Started in Python

var = 'test'

Loading Data in pandas..

import pandas as pd
from matplotlib import pyplot as plt

ransom = pd.read_csv("datasets/ransom.csv")
credit_records = (pd.read_csv("datasets/credit_records.csv"))

#print(ransom)
#print(ransom.head())

print(credit_records.price.sum)

1 hidden cell

Plotting data with Matplotlib

Different Types of Plots

Take Notes

Add notes about the concepts you've learned and code cells with code you want to keep.

Making a scatter plot

plt.scatter(df.age, df.height) plt.xlabel('Age (in months)') plt.ylabel('Height (in inches)') plt.show

plt.scatter(df.age, df.height, color='green', marker='s')

plt.scatter(df.x_data, df.y_daya, alpha=0.1)

Making a bar chart:

plt.bar(df.precint, df.pets_abducted) plt.ylabel('Pet Abductions') plt.show()

horizontal bar: plt.barh(df.precint, df.pets_abducted) plt.ylabel('Pet Abductions') plt.show()

adding error bars: plt.bar(df.precint, df.pet_abductions, yerr=df.error) plt.ylabel('Pet Abductions') plt.show()

stacked bar charts: plt.bar(df.precinct, df.dog, label='Dog') plt.bar(df.precinct, df.cat, bottom=df.dog, label='Cat') plt.legeng() plt.show()

# Add your code snippets here