Revert weird bad .time access

bar_select
Tyler Goodlet 2020-06-17 22:58:54 -04:00
parent d993147f78
commit 6ba0692851
2 changed files with 3 additions and 5 deletions

View File

@ -60,8 +60,8 @@ def from_df(
df: pd.DataFrame, df: pd.DataFrame,
source=None, source=None,
default_tf=None default_tf=None
): ) -> np.recarray:
"""Cast OHLC ``pandas.DataFrame`` to ``numpy.structarray``. """Convert OHLC formatted ``pandas.DataFrame`` to ``numpy.recarray``.
""" """
df.reset_index(inplace=True) df.reset_index(inplace=True)
df['Date'] = [d.timestamp() for d in df.Date] df['Date'] = [d.timestamp() for d in df.Date]
@ -79,10 +79,8 @@ def from_df(
if name not in columns: if name not in columns:
del df[name] del df[name]
df = df.rename(columns=columns) df = df.rename(columns=columns)
# df.insert(0, 'id', df.index)
array = df.to_records() array = df.to_records()
_nan_to_closest_num(array) _nan_to_closest_num(array)
# self._set_time_frame(default_tf)
return array return array

View File

@ -90,7 +90,7 @@ class BaseQuotes(np.recarray):
def convert_dates(self, dates): def convert_dates(self, dates):
breakpoint() breakpoint()
return np.array([d.timestamp().time for d in dates]) return np.array([d.timestamp() for d in dates])
class SymbolType(Enum): class SymbolType(Enum):