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

BeliefsDataFrame initialization with pd.Series fails if serie has a name #64

Open
nhoening opened this issue Sep 8, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@nhoening
Copy link
Contributor

nhoening commented Sep 8, 2021

In this line, TB will use the name of the series if it has one instead of event_value, but then fail later on because the resulting BeliefsDataFrame requires a column of that name.

I propose we drop names of such series if they are argument 0.

P.S. It could be documented a bit clearer that you use a kw arg beliefs for initialization method 1, but non-kw args for method 2 & 3.

@nhoening nhoening added the bug Something isn't working label Sep 8, 2021
@Flix6x
Copy link
Collaborator

Flix6x commented Sep 8, 2021

Can you please add a short example to help me investigate?

@nhoening
Copy link
Contributor Author

nhoening commented Sep 9, 2021

In our flexmeasures-entsoe plugin, I am using the function client.query_generation_forecast from entsoe-py. It returns a pd.Series with a name.

Then I want to create a BeliefsDataFrame from that series:

bdf = BeliefsDataFrame(
     series,
     source=data_source,
     sensor=sensor,
     belief_time=now,
)

This created an error.

I worked around that error by adding this line before the BDF creation:

series.name = "event_value"

Setting it to None would also have worked.

Hope that helps.

@nhoening
Copy link
Contributor Author

Bump: Could this be something we get into the next release? I could imagine it's a one-liner. I could also do this, but @Flix6x, you said you want to investigate, as well.

@Flix6x
Copy link
Collaborator

Flix6x commented Oct 21, 2022

It should be a simple fix indeed, I just didn't get around to it. Feel free to submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants