Skip to content

Remove fillna from modelchain.dc and .ac - #2955

Open
cwhanse wants to merge 2 commits into
pvlib:mainfrom
cwhanse:nansum
Open

cwhanse wants to merge 2 commits into
pvlib:mainfrom
cwhanse:nansum

Conversation

@cwhanse

@cwhanse cwhanse commented Nov 22, 2026 •

Copy link
Copy Markdown
Member
  • Closes DC model unexpectedly fills NaNs with 0 #1409 [BUG]: modelchain fills nan with 0 #2823
  • I am familiar with the contributing guidelines
  • I attest that all AI-generated material has been vetted for accuracy and is in compliance with the pvlib license
  • Tests added
  • Updates entries in docs/sphinx/source/reference for API changes.
  • Adds description and name entries in the appropriate "what's new" file in docs/sphinx/source/whatsnew for all changes. Includes link to the GitHub Issue with :issue:`num` or this Pull Request with :pull:`num`. Includes contributor name and/or GitHub username (link with :ghuser:`user`).
  • New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary.
  • Pull request is nearly complete and ready for detailed review.
  • Maintainer: Appropriate GitHub Labels (including remote-data) and Milestone are assigned to the Pull Request and linked Issue.

Removes fillna(0) from ModelChain generation of DC and AC results.

@cwhanse cwhanse added this to the v0.16.2 milestone Nov 22, 2026
@cwhanse
cwhanse marked this pull request as ready for review November 22, 2026 16:23
@cwhanse

cwhanse commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Checked the examples that use ".sum(" anywhere, results are unaffected.

I don't know if dropping the .fillna(0) statements is going to break some use case. Pandas .sum() method ignores NaN by default, but numpy.sum does not.

In either case, I think pvlib's responsibility ends at Modelchain.Result, which contains time series of DC and AC power. Any summation to energy is on the user side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: modelchain fills nan with 0 DC model unexpectedly fills NaNs with 0

1 participant