Skip to content

Commit

Permalink
Merge pull request #38 from equinor/fix_none_nan
Browse files Browse the repository at this point in the history
Force NaN, not None, for missing values in ODBC handlers
  • Loading branch information
einarsi authored Oct 19, 2020
2 parents 0f491a9 + 4b9ed23 commit 720da78
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tagreader/odbc_handlers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import pyodbc
import pandas as pd
import numpy as np
import warnings
from typing import Union
from .utils import logging, winreg, find_registry_key, ReaderType
Expand Down Expand Up @@ -331,7 +332,7 @@ def read_tag(self, tag, start_time, stop_time, sample_time, read_type, metadata)
self.conn,
index_col="time",
parse_dates={"time": "%Y-%m-%dT%H:%M:%S.%fZ"},
)
).fillna(value=np.nan)
# This warning will trigger also for (at least some) valid tags with no data.
# if len(df.index) == 0:
# warnings.warn(f"Tag {tag} not found")
Expand Down Expand Up @@ -552,7 +553,7 @@ def read_tag(
self.conn,
index_col="time",
parse_dates={"time": "%Y-%m-%d %H:%M:%S"},
)
).fillna(value=np.nan)
# PI ODBC reports aggregate values for both end points, using the end of
# interval as anchor. Normalize to using start of insterval as anchor, and
# remove initial point which is out of defined range.
Expand Down

0 comments on commit 720da78

Please sign in to comment.