Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MetObsAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MetObs
MetObsAPI
Commits
6038a829
Verified
Commit
6038a829
authored
4 weeks ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Fix deprecated pandas indexing
parent
1b6e784f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
metobsapi/util/query_influx.py
+4
-5
4 additions, 5 deletions
metobsapi/util/query_influx.py
pyproject.toml
+3
-1
3 additions, 1 deletion
pyproject.toml
with
7 additions
and
6 deletions
metobsapi/util/query_influx.py
+
4
−
5
View file @
6038a829
"""
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
):
...
...
This diff is collapsed.
Click to expand it.
pyproject.toml
+
3
−
1
View file @
6038a829
...
...
@@ -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]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment