Question: I have pandas Dataframe (70 000 rows) like this:

| No | Time | Length |
| --- | --- | --- |
| 1 | 2.12079 | 60 |
| 2 | 2.581 | 12 |
| 3 | 2.7172 | 60 |
| 4 | 3.43883 | 60 |
| 5 | 3.6883 | 54 |
| 6 | 3.7233 | 54 |
| ... | ... | ... |
| 70 000 | 172.2777 | 24 |

In column Time i have values in float type representing time in seconds. I need to drop rows that has duplicates in length but just in range of 1 second. So my output
should look like this:

| No | Time | Length |
| --- | --- | --- |
| 1 | 2.12079 | 60 |
| 2 | 2.581 | 12 |
| 4 | 3.43883 | 60 |
| 5 | 3.6883 | 54 |
| ... | ... | ... |

Can somebody help me?

Answer: 
Maybe this is what you seek?

```
df["int_time"] = df["Time"].astype(int)
print(
    df.groupby(["Length", "int_time"], as_index=False)
    .first()
    .sort_values(by="No")
    .drop(columns="int_time")
)

```

Prints:

```
   Length     No       Time
3      60      1    2.12079
0      12      2    2.58100
4      60      4    3.43883
2      54      5    3.68830
1      24  70000  172.27770

```
Since your requirement is

> 
> I want to delete duplicates from 1.0000s to 2.000s and then 2.000 to
> 3.000
> 
> 
> 

Create a temporary column that is the `floor` of your time value (same as `//1`), then drop duplicates with respect to that and the length.

```
df = (df.assign(Time2=df.Time//1)
        .drop_duplicates(['Time2', 'Length'])
        .drop(columns='Time2'))

#       No       Time  Length
#0       1    2.12079      60
#1       2    2.58100      12
#3       4    3.43883      60
#4       5    3.68830      54
#6  70 000  172.27770      24

```