如何检查数据帧值是否小于和大于num?

时间:2019-06-18 15:01:49

标签: python pandas dataframe

这是我的脚本:

    xls = pd.ExcelFile(r'Changes log.xlsx')
    df = pd.read_excel(xls, 'New Employment')
    df['Start Date'] = pd.to_datetime(df['Start Date'])
    today = pd.Timestamp.today()

    #Calculate how many days are left til the employee starts working
    df['Days Until Start'] = ((df['Start Date'] - today).dt.days)
    df['Days Until Start'] = df['Days Until Start'].astype(int)

    delta_df = df[['Name', 'Days Until Start']]
    close_delta = delta_df[delta_df['Days Until Start'] < 10]
    close_delta = delta_df[delta_df['Days Until Start'] > 0]
    print(close_delta)

当我打印时,它仅使用最新的命令,该命令使用> 0行。如何检查它们两者?我希望close delta大于0但小于10。

谢谢:)

0 个答案:

没有答案