'RankWarning: Polyfit may be poorly conditioned

I am trying to find the rolling price slope of btc trading data (minute data) using pandas. When I run the script, the following error / warning pops up

sys:1: RankWarning: Polyfit may be poorly conditioned

The url from where I fetch the data is https://data.binance.vision/data/spot/monthly/klines/BTCUSDT/1m/BTCUSDT-1m-2021-01.zip

The rolling price slope is calculated as follows (time period is 30):

result['date_ordinal'] = pd.to_datetime(result['Open Time']).map(dt.datetime.toordinal)

for index, data in result.iterrows():

    price_slope = np.polyfit(result['date_ordinal'][index-time_period:index+1],result['Close'][index-time_period:index+1],1)


Solution 1:[1]

There are too many data, or the degree of your function is very high, or etc.

If you can't solve the problem you can avoid it with :

import warnings

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 Dobromir Chankov