Heim  >  Fragen und Antworten  >  Hauptteil

python - 如何让dataframe中两列时间相减?

ringa_leeringa_lee2741 Tage vor1279

Antworte allen(1)Ich werde antworten

  • ringa_lee

    ringa_lee2017-04-18 10:35:13

    两个字段类型不匹配不能进行运算
    运算之前先转换一下类型

    df['age'] = pd.to_datetime(df['indate']) - pd.to_datetime(df['dob'])

    Antwort
    0
  • StornierenAntwort