Когда я запускаю следующий код:
import pandas as pd
import numpy as np
Master_Revenue_Schedule = 'Master Revenue Schedule.xlsx'
df_Master_Revenue_Schedule = pd.read_excel(Master_Revenue_Schedule)
#print(df_Master_Revenue_Schedule.columns)
df_Coverage_End_Date = df_Master_Revenue_Schedule['coverage_end_date']
df_Coverage_Start_Date = df_Master_Revenue_Schedule['coverage_start_date']
Months_Calc = (df_Coverage_End_Date - df_Coverage_Start_Date)/(365.25/12)
print(Months_Calc)
, я получаю следующее:
0 NaT
1 NaT
2 NaT
3 NaT
4 11 days 23:00:51.745379
...
90 13 days 23:54:05.174537
91 NaT
92 12 days 22:40:09.856262
93 15 days 23:12:41.396303
94 11 days 23:00:51.745379
df_Coverage_End_Date and df_Coverage_Start_Date both contain dates
Я хочу округлить вывод. Я пробовал следующий код, но он не работал.
Rounded_Months_Calc = round(Months_Calc,1)
print(Rounded_Months_Calc)