You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Various pandas deprecation warnings from test suite #1892
We've started getting several types of deprecation warnings from the tests:
pvlib/tests/test_modelchain.py::test_aoi_model_interp
/home/runner/work/pvlib-python/pvlib-python/pvlib/tests/test_modelchain.py:1476: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`
assert mc.results.ac[1] < 1
pvlib/tests/test_clearsky.py::test_detect_clearsky_window
/home/runner/work/pvlib-python/pvlib-python/pvlib/tests/test_clearsky.py:634: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas. Value 'True' has dtype incompatible with int64, please explicitly cast to a compatible dtype first.
expected.iloc[-3:] = True
pvlib/tests/test_singlediode.py: 14 warnings
/home/runner/work/pvlib-python/pvlib-python/pvlib/tests/test_singlediode.py:118: FutureWarning: DataFrame.applymap has been deprecated. Use DataFrame.map instead.
joined[is_number] = joined[is_number].applymap(np.float64)
/home/runner/work/pvlib-python/pvlib-python/pvlib/scaling.py:279: FutureWarning: DataFrame.fillna with 'method' is deprecated and will raise in a future version. Use obj.ffill() or obj.bfill() instead.
df = df.fillna(method='bfill').fillna(method='ffill')
Addressing these would be good first PRs for anyone wanting to get started with contributing to pvlib's codebase! If you plan to submit a PR for one of these warnings, please comment here so that someone else does not duplicate the work.
Ok, I'm tackling this issue. Since is this my first issue, would like to ask about a nuance that I've encountered.
In the test_bird function of test_clearsky.py, we get a warning on lines 857-859:
FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`
The interesting part is that the warning only pertains to etr[12]. The reason why is that out of the 3 objects that are being referenced by an index, only etr is a Pandas series. zenith is a Pandas index type, while airmass is a numpy array. Neither of those have an iloc attribute.
So changing to etr.iloc[12] gets rid of the warning. However, there is now an inconsistency in how we would be referencing these objects. I think it's fine but looking for confirmation especially as I'll potentially run into the same scenario in other warnings that are part of this issue. Thanks.
Wow, three different vector types going into a single function :P Don't worry about the inconsistency with not using iloc for all inputs in that case; changing to just etr.iloc[12] is fine. Maybe that test could be cleaned up a bit more generally, but that would be a separate PR. Thanks @matsuobasho!
I made the updates to get rid of the errors but I get a bunch of failures when I run pytest and I can't be sure that the warnings in question don't also appear in the functions that fail. For example:
Ah yeah, the SRML website has been down for a while and causing the associated tests to fail. If you check the recent CI test results for main you'll see the same failures there.
I suggest ignoring those failing tests for now. If any deprecation warnings come out of those tests whenever they eventually start passing again, we can just address them at that time.
To double-check, are the warnings below in-scope for this issue as well?
The pull request submission form has the following:
Maintainer: Appropriate GitHub Labels (including remote-data) and Milestone are assigned to the Pull Request and linked Issue.
Do I need to add any additional labels to this PR / issue?
Activity
matsuobasho commentedon Oct 24, 2023
Is the intention to resolve these warnings by updating the deprecated methods with current ones, or rather to just hide the deprecation warnings?
cwhanse commentedon Oct 24, 2023
@matsuobasho preferably update the methods to resolve the warnings. If updating breaks other code, perhaps hide them.
matsuobasho commentedon Oct 28, 2023
Ok, I'm tackling this issue. Since is this my first issue, would like to ask about a nuance that I've encountered.
In the
test_birdfunction oftest_clearsky.py, we get a warning on lines 857-859:Here's the warning:
The interesting part is that the warning only pertains to
etr[12]. The reason why is that out of the 3 objects that are being referenced by an index, onlyetris a Pandas series.zenithis a Pandas index type, whileairmassis a numpy array. Neither of those have anilocattribute.So changing to
etr.iloc[12]gets rid of the warning. However, there is now an inconsistency in how we would be referencing these objects. I think it's fine but looking for confirmation especially as I'll potentially run into the same scenario in other warnings that are part of this issue. Thanks.kandersolar commentedon Oct 30, 2023
Wow, three different vector types going into a single function :P Don't worry about the inconsistency with not using
ilocfor all inputs in that case; changing to justetr.iloc[12]is fine. Maybe that test could be cleaned up a bit more generally, but that would be a separate PR. Thanks @matsuobasho!matsuobasho commentedon Oct 30, 2023
I made the updates to get rid of the errors but I get a bunch of failures when I run pytest and I can't be sure that the warnings in question don't also appear in the functions that fail. For example:
Please recommend a course of action, thanks.
kandersolar commentedon Oct 30, 2023
Ah yeah, the SRML website has been down for a while and causing the associated tests to fail. If you check the recent CI test results for
mainyou'll see the same failures there.I suggest ignoring those failing tests for now. If any deprecation warnings come out of those tests whenever they eventually start passing again, we can just address them at that time.
matsuobasho commentedon Oct 30, 2023
To double-check, are the warnings below in-scope for this issue as well?

The pull request submission form has the following:
remote-data) and Milestone are assigned to the Pull Request and linked Issue.Do I need to add any additional labels to this PR / issue?
cwhanse commentedon Oct 30, 2023
@matsuobasho we add the labels to the PR.