In [ ]:
import graphlab
In [ ]:
sf = graphlab.SFrame('people-example.csv')
In [ ]:
# We can view first few lines of the table
sf.head()
In [ ]:
sf.tail()
In [ ]:
# Take any data structure in graphlab Create
sf.show()
In [ ]:
graphlab.canvas.set_target('ipynb')
In [ ]:
sf['age'].show(view='Categorical')
In [ ]:
sf['Country']
In [ ]:
sf['age']
In [ ]:
sf['age'].mean()
In [ ]:
sf['age'].max()
In [ ]:
sf
In [ ]:
sf['Full Name'] = sf['First Name'] + sf['Last Name']
In [ ]:
sf
In [ ]:
sf['age'] * sf['age']
In [ ]:
sf['Country']
In [ ]:
sf['Country'].show()
In [ ]:
def transformCountry(country):
if country == "USA":
return "United States"
else:
return country
transformCountry("USA")
In [ ]:
sf['Country'].apply(transformCountry)
In [ ]:
sf['Country'] = sf['Country'].apply(transformCountry)
In [ ]:
sf