Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
energy
bmon
Commits
34f33f98
Commit
34f33f98
authored
Aug 23, 2021
by
alaskamapscience
Browse files
Small fix to timeseries decimation code
parent
46e43ab5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
bmsapp/data_util.py
bmsapp/data_util.py
+5
-3
No files found.
bmsapp/data_util.py
View file @
34f33f98
...
...
@@ -208,10 +208,12 @@ def decimate_timeseries(df,bin_count=1000,col=None):
# get the indices for the max and min value in each bin
max_indices
=
bins
[
col
].
idxmax
()
max_indices
=
max_indices
.
where
(
~
max_indices
.
isna
(),
bins
.
apply
(
lambda
x
:
x
.
index
[
0
]))
min_indices
=
bins
[
col
].
idxmin
()
keep_indices
=
pd
.
concat
([
max_indices
,
min_indices
]).
drop_duplicates
().
sort_index
()
min_indices
=
bins
[
col
].
idxmin
()
.
dropna
()
keep_indices
=
pd
.
concat
([
max_indices
,
min_indices
]).
drop_duplicates
().
dropna
()
return
df
.
loc
[
keep_indices
]
decimated_df
=
df
.
loc
[
keep_indices
]
return
decimated_df
.
sort_index
()
else
:
return
df
...
...
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