Python pandas in Jupyter
One of the most widely used features of Python is pandas. The pandas are built-in libraries 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 affect of using them in Jupyter.
I am using the Titanic dataset from https://www.kaggle.com/c/titanic/data. I am sure that the same data is available from a variety of sources.
Note
Note that you have to sign up for Kaggle in order to download the data. It's free.
Here is our 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 = float(sum(male.Survived))/len(male) womens_survival_rate, mens_survival_rate
The result is that we calculate the survival rates of the passengers based on sex.
We...