fix: replace deprecated pandas as_matrix() with to_numpy()

DataFrame.as_matrix() was deprecated in pandas 0.25.0 and removed in
later versions. Replace all occurrences with to_numpy() in the
TimeSeriesTensor._df2tensors() method across 5 files.
pull/1013/head
lxcxjxhx 2 months ago
parent d0d0ea2b2d
commit 4074168429

@ -120,13 +120,13 @@ class TimeSeriesTensor(UserDict):
inputs = {} inputs = {}
y = dataframe['target'] y = dataframe['target']
y = y.as_matrix() y = y.to_numpy()
inputs['target'] = y inputs['target'] = y
for name, structure in self.tensor_structure.items(): for name, structure in self.tensor_structure.items():
rng = structure[0] rng = structure[0]
cols = structure[1] cols = structure[1]
tensor = dataframe[name][cols].as_matrix() tensor = dataframe[name][cols].to_numpy()
if rng is None: if rng is None:
tensor = tensor.reshape(tensor.shape[0], len(cols)) tensor = tensor.reshape(tensor.shape[0], len(cols))
else: else:

@ -120,13 +120,13 @@ class TimeSeriesTensor(UserDict):
inputs = {} inputs = {}
y = dataframe['target'] y = dataframe['target']
y = y.as_matrix() y = y.to_numpy()
inputs['target'] = y inputs['target'] = y
for name, structure in self.tensor_structure.items(): for name, structure in self.tensor_structure.items():
rng = structure[0] rng = structure[0]
cols = structure[1] cols = structure[1]
tensor = dataframe[name][cols].as_matrix() tensor = dataframe[name][cols].to_numpy()
if rng is None: if rng is None:
tensor = tensor.reshape(tensor.shape[0], len(cols)) tensor = tensor.reshape(tensor.shape[0], len(cols))
else: else:

@ -120,13 +120,13 @@ class TimeSeriesTensor(UserDict):
inputs = {} inputs = {}
y = dataframe['target'] y = dataframe['target']
y = y.as_matrix() y = y.to_numpy()
inputs['target'] = y inputs['target'] = y
for name, structure in self.tensor_structure.items(): for name, structure in self.tensor_structure.items():
rng = structure[0] rng = structure[0]
cols = structure[1] cols = structure[1]
tensor = dataframe[name][cols].as_matrix() tensor = dataframe[name][cols].to_numpy()
if rng is None: if rng is None:
tensor = tensor.reshape(tensor.shape[0], len(cols)) tensor = tensor.reshape(tensor.shape[0], len(cols))
else: else:

@ -120,13 +120,13 @@ class TimeSeriesTensor(UserDict):
inputs = {} inputs = {}
y = dataframe['target'] y = dataframe['target']
y = y.as_matrix() y = y.to_numpy()
inputs['target'] = y inputs['target'] = y
for name, structure in self.tensor_structure.items(): for name, structure in self.tensor_structure.items():
rng = structure[0] rng = structure[0]
cols = structure[1] cols = structure[1]
tensor = dataframe[name][cols].as_matrix() tensor = dataframe[name][cols].to_numpy()
if rng is None: if rng is None:
tensor = tensor.reshape(tensor.shape[0], len(cols)) tensor = tensor.reshape(tensor.shape[0], len(cols))
else: else:

@ -122,13 +122,13 @@ class TimeSeriesTensor(UserDict):
inputs = {} inputs = {}
y = dataframe['target'] y = dataframe['target']
y = y.as_matrix() y = y.to_numpy()
inputs['target'] = y inputs['target'] = y
for name, structure in self.tensor_structure.items(): for name, structure in self.tensor_structure.items():
rng = structure[0] rng = structure[0]
cols = structure[1] cols = structure[1]
tensor = dataframe[name][cols].as_matrix() tensor = dataframe[name][cols].to_numpy()
if rng is None: if rng is None:
tensor = tensor.reshape(tensor.shape[0], len(cols)) tensor = tensor.reshape(tensor.shape[0], len(cols))
else: else:

Loading…
Cancel
Save