added append_row
This commit is contained in:
@@ -34,6 +34,11 @@ class ArcticLibrary:
|
||||
self.set_data(symbol, df)
|
||||
|
||||
|
||||
def append_row(self, symbol, index, entries):
|
||||
df = pd.DataFrame(entries, index=[index])
|
||||
self.append_data(symbol, df)
|
||||
|
||||
|
||||
def get_data(self, symbol, index=None):
|
||||
if index is not None:
|
||||
index = encode_index(index)
|
||||
|
||||
+1
-3
@@ -2,7 +2,6 @@ from datetime import datetime
|
||||
from http import HTTPStatus
|
||||
from typing import Any
|
||||
|
||||
import pandas as pd
|
||||
from fastapi import APIRouter, HTTPException, Response
|
||||
|
||||
from state import grids, adb
|
||||
@@ -46,8 +45,7 @@ def append_run(beamline: Beamline, pgroup: PGroup, run: int, entries: dict[str,
|
||||
timestamp = datetime.fromisoformat(timestamp) if timestamp else datetime.now()
|
||||
entries = {"timestamp": timestamp, **entries} # setdefault would not force timestamp to be the first column
|
||||
|
||||
df = pd.DataFrame(entries, index=[run])
|
||||
lib.append_data(pgroup, df)
|
||||
lib.append_row(pgroup, run, entries)
|
||||
|
||||
entries = {"run": run, **entries} # setdefault would not force run to be the first column
|
||||
|
||||
|
||||
Reference in New Issue
Block a user