Skip to content

Commit

Permalink
[StatTrack] Be more flexible with date parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexed01 committed Nov 5, 2023
1 parent 9e6a4cc commit f4545ac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions stattrack/driver.py
Expand Up @@ -36,7 +36,7 @@ async def get_last_index(self) -> pd.Timestamp:
index = await cursor.fetchone()
if index is None:
return pd.Timestamp(0)
return pd.to_datetime(index[0])
return pd.to_datetime(index[0], format="ISO8601")

async def read_all(self) -> pd.DataFrame:
"""Create a Pandas DataFrame from the whole table.
Expand All @@ -53,7 +53,7 @@ async def read_all(self) -> pd.DataFrame:
data = await cursor.fetchall()
df = pd.DataFrame(data, columns=columns)
df.set_index("index", inplace=True)
df.index = pd.to_datetime(df.index)
df.index = pd.to_datetime(df.index, format="ISO8601")
return df

async def read_partial(
Expand Down Expand Up @@ -86,7 +86,7 @@ async def read_partial(
data = await cursor.fetchall()
df = pd.DataFrame(data, columns=["index"] + list(metrics))
df.set_index("index", inplace=True)
df.index = pd.to_datetime(df.index)
df.index = pd.to_datetime(df.index, format="ISO8601")
return df

async def write(self, df: pd.DataFrame) -> None:
Expand Down

0 comments on commit f4545ac

Please sign in to comment.