*This playground is inspired by Greg Reda’s post on Intro to Pandas Data Structures:
http://www.gregreda.com/2013/10/26/intro-to-pandas-data-structures/
import pandas as pd if False: series = pd.Series(['Dave', 'Cheng-Han', 'Uxxxx', 42, -1789710578]) print series if False: series = pd.Series(['Dave', 'Cheng-Han', 359, 9001], index=['Instructor', 'Curriculum Manager', 'Course Number', 'Power Level']) print series['Instructor'] print "" print series[['Instructor', 'Curriculum Manager', 'Course Number']] if False: cuteness = pd.Series([1, 2, 3, 4, 5], index=['Cockroach', 'Fish', 'Mini Pig', 'Puppy', 'Kitten']) print cuteness > 3 print "" print cuteness[cuteness > 3]
*This playground is inspired by Greg Reda’s post on Intro to Pandas Data Structures:
http://www.gregreda.com/2013/10/26/intro-to-pandas-data-structures/
import numpy as np import pandas as pd if False: data = {'year': [2010, 2011, 2012, 2011, 2012, 2010, 2011, 2012], 'team':['Bears','Bears','Bears','Packers','Lions','Lions','Lions'], 'wins': [11, 8, 10, 15, 11, 6, 10, 4], 'losses':[5, 8, 6, 1, 5, 10, 6, 12]} football = pd.DataFrame(data) print football if False: data = {'year':[2010, 2011, 2012, 2011, 2012, 2010, 2011, 2012], 'team':['Bears','Bears','Bears','Packers','Packers','Lions', 'Lions','Lions'], 'wins':[11, 8, 10, 15, 11, 6, 10, 4], 'losses':[5, 8, 6, 1, 5, 10, 6, 12]} football = pd.DataFrame(data) print football.dtypes print "" print football.describe() print "" print football.head() print "" print football.tail()