question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

group_by: date not working as expected

See original GitHub issue

I am using following definition

- type: custom:mini-graph-card
  entities:
    - entity: sensor.socket_dishwasher_energy_today
  name: Dishwasher
  aggregate_func: max
  group_by: date
  hours_to_show: 168
  show:
    graph: bar

So I expect that for each day maximum value calculated and single bar for this day will be present on the graph. Instead, I see the following: Capture1 What am I doing wrong?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
maxwroccommented, Oct 22, 2019

I don’t have time to look in the code now but i suspect where the problem might be located…

There is this place where we set the result array length. It is little bit odd anyway. And I think that what happens here is that there is not enough data to cover 7 days, we put the available data on the beginning of the array and then extend it to 7 items. The result is that first bars show correct values and the rest just repeat the last value. This is corner case which I haven’t tested. To be honest I don’t know then how come it works for line graphs 😃 as the logic is the same. If you have time before weekend you can try to fix it if not I’ll do it on Fri/Sat

0reactions
stepanov1975commented, Oct 22, 2019

No, the second one from InfluxDB but the data should be same And the line graph looks right Capture

Read more comments on GitHub >

github_iconTop Results From Across the Web

pandas groupby datetime.date object is not consistent
We can see pandas groupby is too smart to change datetime.date object to Timestamp object. And it mess up indexing, we can not...
Read more >
Date group by not working as expected - Dashboards
Date group by not working as expected when date range is from 1-nov the group by feature working correctly but when the date...
Read more >
Grouping dates in reports not working as expected
We have started using the grouping function within several reports and grouping on a date field but we are coming across tasks with...
Read more >
Group by Date not working - Qlik Community - 59839
Hi, I am trying to group a table that has hourly entries such that it rolls in up into daily entries; I have...
Read more >
7 Common GROUP BY Errors - LearnSQL.com
1. Forgetting GROUP BY with Aggregate Functions · 2. Confusing WHERE and HAVING · 3. Listing a Column Inside SELECT but Not in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found