问题
So, I have a pandas dataframe with a lot of variables including start/end date of loans. I subtract these two in order to get their difference in days. The result I get is of the type i.e. 349 days 00:00:00. How can I keep only for example the number 349 from this column?
回答1:
Check this format,
df['date'] = pd.to_timedelta(df['date'], errors='coerce').days
also, check .normalize()
function in pandas.
来源:https://stackoverflow.com/questions/58059278/remove-days-000000from-dataframe