Question: ```
df = pd.read_sql_query(query, con, parse_dates=["time"]).set_index("time")
type(df_aq.index)

```

Why does this set index as DatetimeIndex (pandas.core.indexes.datetimes.DatetimeIndex) while the code below returns a RangeIndex (pandas.core.indexes.range.RangeIndex):

```
df = pd.read_sql_query(query, con, parse_dates=["time"])
df.set_index("time")
type(df_aq.index)

```

Answer: 
You can use MIN to not allow the value to become greater than `0`

```
=MIN(SUM(A1,A2),0)

```

This will make any positive number `0` because `0` is lower than any positive number.
Something like this?

```
=IF(SUM(J87+K87)>0,0,J87+K87)

```

[![enter image description here](https://i.stack.imgur.com/qnory.png)](https://i.stack.imgur.com/qnory.png)

[![enter image description here](https://i.stack.imgur.com/7QOfs.png)](https://i.stack.imgur.com/7QOfs.png)