Python pandas in Jupyter

One of the most widely used features of Python is pandas. It is a third-party library of data analysis packages that can be used freely. In this example, we will develop a Python script that uses pandas to see if there is any effect to using it in Jupyter.

I am using the Titanic dataset from http://www.kaggle.com/c/titanic-gettingStarted/download/train.csv. I am sure the same data is available from a variety of sources.

Here is the Python script that we want to run in Jupyter:

from pandas import *
training_set = read_csv('train.csv')
training_set.head()
male = training_set[training_set.sex == 'male']
female = training_set[training_set.sex =='female']
womens_survival_rate = float(sum(female.survived))/len(female)
mens_survival_rate ...

Get Learning Jupyter now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.