Skip to content
Snippets Groups Projects
Verified Commit 6038a829 authored by David Hoese's avatar David Hoese
Browse files

Fix deprecated pandas indexing

parent 1b6e784f
No related branches found
No related tags found
No related merge requests found
"""Helpers for querying an InfluxDB backend."""
from datetime import datetime, timedelta
from typing import TypeAlias
......@@ -76,13 +77,12 @@ class QueryHandler:
frame = frame.set_index("time")
frame = frame.fillna(value=np.nan)
frames.append(frame)
frame = pd.concat(frames, axis=1, copy=False)
return frame
return pd.concat(frames, axis=1, copy=False)
def _convert_v2_result_to_api_dataframe(self, result: QueryResult) -> pd.DataFrame:
frames_to_concat = []
for (site, inst), symbol_names in self._symbols.items():
frames_for_inst = [df for df in result if df["site"][0] == site and df["inst"][0] == inst]
frames_for_inst = [df for df in result if df["site"].iloc[0] == site and df["inst"].iloc[0] == inst]
if not frames_for_inst:
data_frame = pd.DataFrame(columns=["_time", *symbol_names])
data_frame = data_frame.set_index("_time")
......@@ -117,8 +117,7 @@ def _build_queries_v1(symbols, begin, end, interval):
where_clause=" AND ".join(wc),
)
queries.append(query)
queries = "; ".join(queries)
return queries
return "; ".join(queries)
def parse_dt_v1(d):
......
......@@ -28,6 +28,8 @@ exclude = '''
[tool.ruff]
line-length = 120
[tool.ruff.lint]
select = [
"E", "F", "W", "C90", "I", "N", "D", "UP", "YTT", "S", "BLE", "B", "A",
"COM", "C4", "T10", "EXE", "ISC", "ICN", "INP", "PIE", "T20", "PYI", "PT",
......@@ -36,7 +38,7 @@ select = [
]
ignore = ["D100", "D101", "D102", "D103", "D104", "D106", "D107", "D203", "D213", "B008"]
[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"metobsapi/tests/*" = ["S", "PLR2004"]
[tool.mypy]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment