graphlab create使用
1.SFrame
print(sf)

import graphlab
sf = graphlab.SFrame('xx.csv')
print(sf)
sf.head #查看前几行
sf.tail #尾几行
#canvas
sf.show() #新开页面展示信息
#重定向到本页面
graphlab.canvas.set_target('ipynb')
sf['age'].show(view='Categorical')
#操作列数据
sf['Country'] #显示一列
sf['age'].mean() #平均值
sf['age'].max() #最大值
#增加新列
sf['Ful Name'] = sf['first name']+' ' + sf['last name']
sf['age'] + 2
#应用apply函数来转换数据
sf['coutry'].show()
def transform_country(country):
if country == 'USA':
return 'United
else:
return country
sf['Country'].apply( transform_country) #应用
sf['Country'] = sf['Country'].apply( transform_country) #赋值
浙公网安备 33010602011771号