Closed pbalm closed 3 years ago
Kudos, SonarCloud Quality Gate passed!
0 Bugs
0 Vulnerabilities (and 0 Security Hotspots to review)
0 Code Smells
No Coverage information
0.0% Duplication
I also have some code to convert the output to a pandas DataFrame but I didn't want to include it because that would introduce a dependency on pandas. But perhaps I should have included it in the example in the README. It goes like this:
import pandas as pd
start = date.today() - timedelta(days=7)
end = date.today() - timedelta(days=1)
values = connection.consumption(start, end)
times = pd.date_range(start=start, end=datetime.combine(end, datetime.min.time()) + timedelta(hours=23), freq='h')
times_local = times.tz_localize('CET', ambiguous='NaT', nonexistent='shift_forward')
df = pd.DataFrame(index=times_local, data={'values': values})
I also have some code to convert the output to a pandas DataFrame but I didn't want to include it because that would introduce a dependency on pandas. But perhaps I should have included it in the example in the README. It goes like this:
import pandas as pd start = date.today() - timedelta(days=7) end = date.today() - timedelta(days=1) values = connection.consumption(start, end) times = pd.date_range(start=start, end=datetime.combine(end, datetime.min.time()) + timedelta(hours=23), freq='h') times_local = times.tz_localize('CET', ambiguous='NaT', nonexistent='shift_forward') df = pd.DataFrame(index=times_local, data={'values': values})
@pbalm, You could add it in the demo folder: https://github.com/hectorespert/python-oligo/tree/master/demo
Adding function
consumption
that will retrieve the hourly consumption in Wh, always for the hour preceding to the corresponding instant.