def _validated_tuples_to_dataframe(self, validated_tuples):
if validated_tuples == []:
dts, values, estimateds = [], [], []
else:
dts, values, estimateds = zip(*validated_tuples)
if self.parse_dates:
dts = [dateutil.parser.parse(dt) for dt in dts]
index = pd.DatetimeIndex(dts)
if index.shape[0] > 0:
index = index.tz_convert(pytz.UTC)
df = pd.DataFrame(
{"value": values, "estimated": estimateds},
index=index,
columns=["value", "estimated"],
)
df.value = df.value.astype(float)
df.estimated = df.estimated.astype(bool)
return df
评论列表
文章目录