If the first column is more than the second, replace the first value with the second



  • How to do what in the DataFrame, replace the value of the first column by the second column. введите сюда описание изображения

    It's necessary that when a column installs is less than a day than a column serve_time, the date in the installs column has been replaced by the date in the column server_time. Can you tell me what to do?



  • I need a column installs less than a day after day. serve_time, date in column installs replaced by date in column server_time.

    Well, literally, as it says, in those lines that satisfy the condition, change this for this:

    condition = df['installs'] < df['server_time']
    df.loc[condition, 'installs'] = df.loc[condition, 'server_time']
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2