Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid using df.sqeeze() for getting main df series #216

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions arpav_ppcv/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,22 +621,31 @@ def get_coverage_time_series(
end,
cov.identifier,
)
coverage_result[(cov, base.CoverageDataSmoothingStrategy.NO_SMOOTHING)] = df[
cov.identifier
].squeeze()
for smoothing_strategy in additional_coverage_smoothing_strategies:
df, smoothed_column = process_coverage_smoothing_strategy(
df,
cov.identifier,
smoothing_strategy,
ignore_warnings=(not settings.debug),
)
coverage_result[(cov, smoothing_strategy)] = df[smoothed_column].squeeze()
unsmoothed_data = df[cov.identifier]
coverage_result[
(cov, base.CoverageDataSmoothingStrategy.NO_SMOOTHING)
] = unsmoothed_data
if unsmoothed_data.count() > 1:
for smoothing_strategy in additional_coverage_smoothing_strategies:
df, smoothed_column = process_coverage_smoothing_strategy(
df,
cov.identifier,
smoothing_strategy,
ignore_warnings=(not settings.debug),
)
coverage_result[(cov, smoothing_strategy)] = df[
smoothed_column
].squeeze()

if not include_coverage_data:
del coverage_result[(coverage, base.CoverageDataSmoothingStrategy.NO_SMOOTHING)]
for smoothing_strategy in additional_coverage_smoothing_strategies:
del coverage_result[(coverage, smoothing_strategy)]
try:
del coverage_result[(coverage, smoothing_strategy)]
except (
KeyError
): # requested smoothing may not be present if the data has a single row
pass

observation_result = None
if include_observation_data:
Expand Down