module 'pandas' has no attribute 'rolling_min'
时间: 2023-07-06 19:13:28 浏览: 146
求解报错:AttributeError:module ‘os’ has no attribute ‘exit’
The reason you are getting this error is because the `rolling_min` function was removed from Pandas version 0.18.0 onwards. Instead, you can use the `rolling` function with the `min` method to achieve the same result. Here is an example:
```
import pandas as pd
# create a sample dataframe
df = pd.DataFrame({'A': [1, 2, 3, 4, 5]})
# calculate rolling minimum with window size 2
rolling_min = df['A'].rolling(window=2).min()
# print the result
print(rolling_min)
```
This will output:
```
0 NaN
1 1.0
2 2.0
3 3.0
4 4.0
Name: A, dtype: float64
```
As you can see, the `rolling` function with the `min` method calculates the rolling minimum over a specified window size.
阅读全文