dataframe按照条件删除行
#存储每天 涨幅排行榜,避免每次读取耗时过长
filename=self.today+'.xls'
filename=os.path.join(os.getcwd(),filename)
if not os.path.exists(filename):
self.df_today_all=ts.get_today_all()
#过滤停牌的
self.df_today_all.drop(self.df_today_all[self.df_today_all['turnoverratio']==0].index,inplace=True)
#实测可用,删除的方法
#n1=self.df_today_all[self.df_today_all['turnoverratio']==0]
#n2=self.df_today_all.drop(n1.index)
#print n2
print self.df_today_all
self.df_today_all.to_excel(filename)
else:
self.df_today_all=pd.read_excel(filename)
print self.df_today_all
filename=self.today+'.xls'
filename=os.path.join(os.getcwd(),filename)
if not os.path.exists(filename):
self.df_today_all=ts.get_today_all()
#过滤停牌的
self.df_today_all.drop(self.df_today_all[self.df_today_all['turnoverratio']==0].index,inplace=True)
#实测可用,删除的方法
#n1=self.df_today_all[self.df_today_all['turnoverratio']==0]
#n2=self.df_today_all.drop(n1.index)
#print n2
print self.df_today_all
self.df_today_all.to_excel(filename)
else:
self.df_today_all=pd.read_excel(filename)
print self.df_today_all