mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
Merge pull request #9871 from freqtrade/dependabot/pip/develop/pandas-2.2.1
Bump pandas from 2.1.4 to 2.2.1
This commit is contained in:
@@ -35,7 +35,7 @@ class HDF5DataHandler(IDataHandler):
|
|||||||
self.create_dir_if_needed(filename)
|
self.create_dir_if_needed(filename)
|
||||||
|
|
||||||
_data.loc[:, self._columns].to_hdf(
|
_data.loc[:, self._columns].to_hdf(
|
||||||
filename, key, mode='a', complevel=9, complib='blosc',
|
filename, key=key, mode='a', complevel=9, complib='blosc',
|
||||||
format='table', data_columns=['date']
|
format='table', data_columns=['date']
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ class HDF5DataHandler(IDataHandler):
|
|||||||
key = self._pair_trades_key(pair)
|
key = self._pair_trades_key(pair)
|
||||||
|
|
||||||
data.to_hdf(
|
data.to_hdf(
|
||||||
self._pair_trades_filename(self._datadir, pair), key,
|
self._pair_trades_filename(self._datadir, pair), key=key,
|
||||||
mode='a', complevel=9, complib='blosc',
|
mode='a', complevel=9, complib='blosc',
|
||||||
format='table', data_columns=['timestamp']
|
format='table', data_columns=['timestamp']
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class JsonDataHandler(IDataHandler):
|
|||||||
self.create_dir_if_needed(filename)
|
self.create_dir_if_needed(filename)
|
||||||
_data = data.copy()
|
_data = data.copy()
|
||||||
# Convert date to int
|
# Convert date to int
|
||||||
_data['date'] = _data['date'].view(np.int64) // 1000 // 1000
|
_data['date'] = _data['date'].astype(np.int64) // 1000 // 1000
|
||||||
|
|
||||||
# Reset index, select only appropriate columns and save as json
|
# Reset index, select only appropriate columns and save as json
|
||||||
_data.reset_index(drop=True).loc[:, self._columns].to_json(
|
_data.reset_index(drop=True).loc[:, self._columns].to_json(
|
||||||
|
|||||||
@@ -107,9 +107,9 @@ class LookaheadAnalysisSubFunctions:
|
|||||||
csv_df = add_or_update_row(csv_df, new_row_data)
|
csv_df = add_or_update_row(csv_df, new_row_data)
|
||||||
|
|
||||||
# Fill NaN values with a default value (e.g., 0)
|
# Fill NaN values with a default value (e.g., 0)
|
||||||
csv_df['total_signals'] = csv_df['total_signals'].fillna(0)
|
csv_df['total_signals'] = csv_df['total_signals'].astype(int).fillna(0)
|
||||||
csv_df['biased_entry_signals'] = csv_df['biased_entry_signals'].fillna(0)
|
csv_df['biased_entry_signals'] = csv_df['biased_entry_signals'].astype(int).fillna(0)
|
||||||
csv_df['biased_exit_signals'] = csv_df['biased_exit_signals'].fillna(0)
|
csv_df['biased_exit_signals'] = csv_df['biased_exit_signals'].astype(int).fillna(0)
|
||||||
|
|
||||||
# Convert columns to integers
|
# Convert columns to integers
|
||||||
csv_df['total_signals'] = csv_df['total_signals'].astype(int)
|
csv_df['total_signals'] = csv_df['total_signals'].astype(int)
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ def _get_resample_from_period(period: str) -> str:
|
|||||||
# Weekly defaulting to Monday.
|
# Weekly defaulting to Monday.
|
||||||
return '1W-MON'
|
return '1W-MON'
|
||||||
if period == 'month':
|
if period == 'month':
|
||||||
return '1M'
|
return '1ME'
|
||||||
raise ValueError(f"Period {period} is not supported.")
|
raise ValueError(f"Period {period} is not supported.")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1155,7 +1155,7 @@ class RPC:
|
|||||||
}
|
}
|
||||||
if has_content:
|
if has_content:
|
||||||
|
|
||||||
dataframe.loc[:, '__date_ts'] = dataframe.loc[:, 'date'].view(int64) // 1000 // 1000
|
dataframe.loc[:, '__date_ts'] = dataframe.loc[:, 'date'].astype(int64) // 1000 // 1000
|
||||||
# Move signal close to separate column when signal for easy plotting
|
# Move signal close to separate column when signal for easy plotting
|
||||||
for sig_type in signals.keys():
|
for sig_type in signals.keys():
|
||||||
if sig_type in dataframe.columns:
|
if sig_type in dataframe.columns:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
numpy==1.26.4
|
numpy==1.26.4
|
||||||
pandas==2.1.4
|
pandas==2.2.1
|
||||||
pandas-ta==0.3.14b
|
pandas-ta==0.3.14b
|
||||||
|
|
||||||
ccxt==4.2.51
|
ccxt==4.2.51
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ def generate_test_data(timeframe: str, size: int, start: str = '2020-07-05'):
|
|||||||
def generate_test_data_raw(timeframe: str, size: int, start: str = '2020-07-05'):
|
def generate_test_data_raw(timeframe: str, size: int, start: str = '2020-07-05'):
|
||||||
""" Generates data in the ohlcv format used by ccxt """
|
""" Generates data in the ohlcv format used by ccxt """
|
||||||
df = generate_test_data(timeframe, size, start)
|
df = generate_test_data(timeframe, size, start)
|
||||||
df['date'] = df.loc[:, 'date'].view(np.int64) // 1000 // 1000
|
df['date'] = df.loc[:, 'date'].astype(np.int64) // 1000 // 1000
|
||||||
return list(list(x) for x in zip(*(df[x].values.tolist() for x in df.columns)))
|
return list(list(x) for x in zip(*(df[x].values.tolist() for x in df.columns)))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -498,7 +498,7 @@ def test__get_resample_from_period():
|
|||||||
|
|
||||||
assert _get_resample_from_period('day') == '1d'
|
assert _get_resample_from_period('day') == '1d'
|
||||||
assert _get_resample_from_period('week') == '1W-MON'
|
assert _get_resample_from_period('week') == '1W-MON'
|
||||||
assert _get_resample_from_period('month') == '1M'
|
assert _get_resample_from_period('month') == '1ME'
|
||||||
with pytest.raises(ValueError, match=r"Period noooo is not supported."):
|
with pytest.raises(ValueError, match=r"Period noooo is not supported."):
|
||||||
_get_resample_from_period('noooo')
|
_get_resample_from_period('noooo')
|
||||||
|
|
||||||
|
|||||||
@@ -1022,22 +1022,22 @@ def test_auto_hyperopt_interface_loadparams(default_conf, mocker, caplog):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('function,raises', [
|
@pytest.mark.parametrize('function,raises', [
|
||||||
('populate_entry_trend', True),
|
('populate_entry_trend', False),
|
||||||
('advise_entry', False),
|
('advise_entry', False),
|
||||||
('populate_exit_trend', True),
|
('populate_exit_trend', False),
|
||||||
('advise_exit', False),
|
('advise_exit', False),
|
||||||
])
|
])
|
||||||
def test_pandas_warning_direct(ohlcv_history, function, raises):
|
def test_pandas_warning_direct(ohlcv_history, function, raises, recwarn):
|
||||||
|
|
||||||
df = _STRATEGY.populate_indicators(ohlcv_history, {'pair': 'ETH/BTC'})
|
df = _STRATEGY.populate_indicators(ohlcv_history, {'pair': 'ETH/BTC'})
|
||||||
if raises:
|
if raises:
|
||||||
with pytest.warns(FutureWarning):
|
assert len(recwarn) == 1
|
||||||
# Test for Future warning
|
# https://github.com/pandas-dev/pandas/issues/56503
|
||||||
# FutureWarning: Setting an item of incompatible dtype is
|
# Fixed in 2.2.x
|
||||||
# deprecated and will raise in a future error of pandas
|
getattr(_STRATEGY, function)(df, {'pair': 'ETH/BTC'})
|
||||||
# https://github.com/pandas-dev/pandas/issues/56503
|
|
||||||
getattr(_STRATEGY, function)(df, {'pair': 'ETH/BTC'})
|
|
||||||
else:
|
else:
|
||||||
|
assert len(recwarn) == 0
|
||||||
|
|
||||||
getattr(_STRATEGY, function)(df, {'pair': 'ETH/BTC'})
|
getattr(_STRATEGY, function)(df, {'pair': 'ETH/BTC'})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user