我正在使用Reql,我面临的问题是我需要以正确的顺序过滤相同的弹出值。
采用pluck和distinct()后,值正确但顺序不正确,订单丢失。
示例查询
r.db('DB').table("heroes").orderBy('createdAt')
.pluck({'loc':['coordinates']})
.distinct()
任何人都可以帮我修改查询,以便按正确的顺序返回数据。
感谢您的时间。
答案 0 :(得分:0)
在寻找另一个解决方法之后,我发布了问题here(感谢@trincot),通过复制此示例数组的解决方案,在javascript中完成工作,而不是处理重复的lat long数组。获得明确的结果并维持订单。
def calculate (allFiles):
data = []
for file_ in allFiles:
xls = pd.ExcelFile(file_)
df = xls.parse('General Impact')
Mid_Ebb = df[df['Tidal Mode'] == "Mid-Ebb"] #filter
Mid_Ebb_control = df[df['Station'].isin(['C1','C2','C3'])] #filter control
Mid_Flood = df[df['Tidal Mode'] == "Mid-Flood"] #filter
Mid_Flood_control = df[df['Station'].isin(['C1','C2','C3', 'SR2'])] #filter control
total_Mid_Ebb = Mid_Ebb.Station.nunique() #count unique stations = sample number
total_Mid_Flood = Mid_Flood.Station.nunique()
total_Mid_EbbControl = Mid_Ebb_control.Station.nunique()
total_Mid_FloodControl = Mid_Flood_control.Station.nunique()
data.append((total_Mid_Ebb,
total_Mid_Flood,
total_Mid_EbbControl,
total_Mid_FloodControl))
cols=['total_Mid_Ebb','total_Mid_Flood','total_Mid_EbbControl','total_Mid_FloodControl']
result = pd.DataFrame(data, columns=cols)
result['Mid_Ebb_withoutControl'] = result.total_Mid_Ebb - result.total_Mid_EbbControl
result['Mid_Flood_withoutControl']=result.total_Mid_Flood-result.total_Mid_FloodControl
#if want check all totals
total = result.sum()
print (total)
return result
如果有人可能会得到帮助。欢呼。