Skip to content

Commit 018c230

Browse files
code sample for pandas-dev#46819
1 parent 7224941 commit 018c230

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

bisect/46819.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# BUG: Timedelta.total_seconds method is returning wrong values in nanosecond intervals #46819
2+
3+
4+
import numpy as np
5+
import pandas as pd
6+
7+
print(pd.__version__)
8+
9+
duration, Ts = 0.5, 5e-7
10+
signal = pd.to_timedelta(np.arange(0, duration, Ts), "s")
11+
12+
dt = signal[1] - signal[0]
13+
14+
result = dt.total_seconds()
15+
print(result) # = 5e-07
16+
17+
18+
assert result == 5e-07

0 commit comments

Comments
 (0)