微软

select city  from c

where companyId>AVG(companyId)       wrong

select city  from c

where companyId>(select AVG(companyId)  from c)    right


SELECT Customer FROM Orders
WHERE OrderPrice>(SELECT AVG(OrderPrice) FROM Orders)

import pandas as pd
import numpy as np
titanic_survival = pd.read_csv("titanic_train.csv")
titanic_survival.head()
 
  
  

import pandas as pd  
train_data = pd.read_csv("train.csv")  
  
# 将标签转为0,1,2,3,4,...  
# 去掉重复的  
species = train_data['species'].unique()  
print species  
# 转为0,1,2,3,4,...  
species = pd.Series(range(0, len(species)), index=list(species))  
print species  
  
# 修改标签数据为:0,1,2,3,4,...  
def fix_spieces(line):  
    line['species'] = species.loc[line['species']]  
    return line  
train_data = train_data.apply(fix_spieces, axis=1)  
print train_data[0:4]  
  
# 返回numpy数据。  
# 下标从0开始。  
# 取样本数据,所有行:第二列到最后一列。  
train_data.values[0::, 2::]  
# 取标签数据,所有行:第一列。  
train_data.values[0::, 1]  

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页