Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
U
unify_api2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chaonan
unify_api2
Commits
8663e19b
Commit
8663e19b
authored
Apr 21, 2023
by
lcn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复Bug
parent
2e78d4a7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
electric_service.py
unify_api/modules/electric/service/electric_service.py
+8
-10
No files found.
unify_api/modules/electric/service/electric_service.py
View file @
8663e19b
...
...
@@ -784,13 +784,12 @@ async def elec_index_service_new15(cid, point_id, start, end):
common_indexes
=
[]
_common_items
=
{
i
.
rsplit
(
"_"
,
1
)[
0
]
for
i
in
common_items
}
for
item
in
_common_items
:
item_name
=
item
.
rsplit
(
"_"
,
1
)[
0
]
if
datas
:
max_item_name
=
f
"{item}_max"
max_value
=
df
[
max_item_name
]
.
max
()
if
not
pd
.
isna
(
max_value
):
max_datas
=
df
.
loc
[
df
[
max_item_name
]
.
idxmax
()]
.
to_dict
()
max_time
=
max_datas
.
get
(
f
"{item
_name
}_max_time"
)
max_time
=
max_datas
.
get
(
f
"{item}_max_time"
)
max_time
=
''
if
pd
.
isnull
(
max_time
)
else
str
(
max_time
)
else
:
max_value
,
max_time
=
""
,
""
...
...
@@ -798,7 +797,7 @@ async def elec_index_service_new15(cid, point_id, start, end):
min_value
=
df
[
min_item_name
]
.
min
()
if
not
pd
.
isna
(
min_value
):
min_datas
=
df
.
loc
[
df
[
min_item_name
]
.
idxmin
()]
.
to_dict
()
min_time
=
min_datas
.
get
(
f
"{item
_name
}_min_time"
)
min_time
=
min_datas
.
get
(
f
"{item}_min_time"
)
min_time
=
''
if
pd
.
isnull
(
min_time
)
else
str
(
min_time
)
else
:
min_value
,
min_time
=
""
,
""
...
...
@@ -809,7 +808,7 @@ async def elec_index_service_new15(cid, point_id, start, end):
else
:
avg_value
=
""
elec_index
=
ElecIndex
(
stats_index
=
item
_name
,
stats_index
=
item
,
max
=
max_value
,
max_time
=
max_time
or
""
,
min
=
min_value
,
...
...
@@ -818,7 +817,7 @@ async def elec_index_service_new15(cid, point_id, start, end):
)
else
:
elec_index
=
ElecIndex
(
stats_index
=
item
_name
,
stats_index
=
item
,
max
=
""
,
max_time
=
""
,
min
=
""
,
...
...
@@ -830,13 +829,12 @@ async def elec_index_service_new15(cid, point_id, start, end):
elec_qual_indexes
=
[]
_elec_qual_items
=
{
i
.
rsplit
(
"_"
,
1
)[
0
]
for
i
in
elec_qual_items
}
for
item
in
_elec_qual_items
:
item_name
=
item
.
rsplit
(
"_"
,
1
)[
0
]
if
datas
:
max_item_name
=
f
"{item}_max"
max_value
=
df
[
max_item_name
]
.
max
()
if
not
pd
.
isna
(
max_value
):
max_datas
=
df
.
loc
[
df
[
max_item_name
]
.
idxmax
()]
.
to_dict
()
max_time
=
max_datas
.
get
(
f
"{item
_name
}_max_time"
)
max_time
=
max_datas
.
get
(
f
"{item}_max_time"
)
max_time
=
''
if
pd
.
isnull
(
max_time
)
else
str
(
max_time
)
else
:
max_value
,
max_time
=
""
,
""
...
...
@@ -844,7 +842,7 @@ async def elec_index_service_new15(cid, point_id, start, end):
min_value
=
df
[
min_item_name
]
.
min
()
if
not
pd
.
isna
(
min_value
):
min_datas
=
df
.
loc
[
df
[
min_item_name
]
.
idxmin
()]
.
to_dict
()
min_time
=
min_datas
.
get
(
f
"{item
_name
}_min_time"
)
min_time
=
min_datas
.
get
(
f
"{item}_min_time"
)
min_time
=
''
if
pd
.
isnull
(
min_time
)
else
str
(
min_time
)
else
:
min_value
,
min_time
=
""
,
""
...
...
@@ -855,7 +853,7 @@ async def elec_index_service_new15(cid, point_id, start, end):
else
:
avg_value
=
""
elec_index
=
ElecIndex
(
stats_index
=
item
_name
,
stats_index
=
item
,
max
=
max_value
,
max_time
=
max_time
,
min
=
min_value
,
...
...
@@ -864,7 +862,7 @@ async def elec_index_service_new15(cid, point_id, start, end):
)
else
:
elec_index
=
ElecIndex
(
stats_index
=
item
_name
,
stats_index
=
item
,
max
=
""
,
max_time
=
""
,
min
=
""
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment