我将this # (Y)或not (N)的出现放在一个单独的列中,称为“开始”。 我想查找不以#开头的行,如果下面的行也不是以#开头,我想将这两行合并在一起。我的循环可以工作,但我如何使用lambda函数或任何其他方式来获得良好的速度?提前致谢 for i in range(2,(len(df)-1)):
if ((df['Beginning'][i] == 'N') and (df['Beginning'][i+1] =='N')):
我可以使用query()实现这一点--参见下面的代码。df=df.append(pd.Series(([float(i) for i in cols]), index=col_labels), ignore_index=True)
print(df.loc[(df.query('Krg != 0')['Krg'].idxmin())-1,
我想将以下两个sql语句连接成一个语句,这样我总共有23行(第一个sql有23行,第二个有20行),第一个sql和第二个sql中的h3dac值出现在列中。
有什么工作要做吗?location as loc1, date as date2, shift as shift2, h3dac as h3dac2 from shiftdata where unit= 1 ORDERBY date desc, shift desc limit 23 offset 23) as b