'I want to convert my days format to seconds in pandas

In my dataframe I made a column for average delay which was the mean of a company's delay for clearing a certain amount. Since my average delay and delay contained negative values like -3 days , I was hoping that when I convert my average delay to seconds it will be negative too but it was positive. what did I do wrong?

avg_delay = maindata.groupby('name_customer')['delay'].mean(numeric_only=False)    


maindata['avg_delay'] = maindata['avg_delay'].dt.seconds      


Solution 1:[1]

It might be because the .dt.seconds return at max 86400 seconds by the pandas documentation

.dt.total_seconds() might do the job, returning it as float64

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1