Skip to content

Bump minimum pandas version to 0.22.0, switch from pd.util.testing to pd.testing #1003

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

Merged
merged 5 commits into from
Jul 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/requirements-py35-min.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ dependencies:
- requests
- pip:
- numpy==1.12.0
- pandas==0.18.1
- pandas==0.22.0
- pytest-rerunfailures # conda version is >3.6
- pytest-remotedata # conda package is 0.3.0, needs > 0.3.1
1 change: 1 addition & 0 deletions docs/sphinx/source/whatsnew/v0.8.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Documentation

Requirements
~~~~~~~~~~~~
* Minimum pandas version increased to v0.22.0, released Dec 31, 2017. (:pull:`1003`)

Contributors
~~~~~~~~~~~~
Expand Down
8 changes: 0 additions & 8 deletions pvlib/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,6 @@ def numpy_1_10():
not numpy_1_10(), reason='requires numpy 1.10 or greater')


def pandas_0_22():
return parse_version(pd.__version__) >= parse_version('0.22.0')


needs_pandas_0_22 = pytest.mark.skipif(
not pandas_0_22(), reason='requires pandas 0.22 or greater')


def has_spa_c():
try:
from pvlib.spa_c_files.spa_py import spa_calc
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/iotools/test_crn.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pandas as pd
from pandas.util.testing import assert_frame_equal
from pandas.testing import assert_frame_equal
import numpy as np
from numpy import dtype, nan
import pytest
Expand Down
2 changes: 0 additions & 2 deletions pvlib/tests/iotools/test_epw.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from pandas.util.testing import network
import pytest

from pvlib.iotools import epw
Expand All @@ -11,7 +10,6 @@ def test_read_epw():
epw.read_epw(epw_testfile)


@network
@pytest.mark.remote_data
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
def test_read_epw_remote():
Expand Down
2 changes: 0 additions & 2 deletions pvlib/tests/iotools/test_midc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pandas as pd
from pandas.util.testing import network
import pytest
import pytz

Expand Down Expand Up @@ -64,7 +63,6 @@ def test_read_midc_var_mapping_as_arg(test_mapping):
assert 'temp_air' in data.columns


@network
@pytest.mark.remote_data
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
def test_read_midc_raw_data_from_nrel():
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/iotools/test_solrad.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pandas as pd
from pandas.util.testing import assert_frame_equal
from pandas.testing import assert_frame_equal
import numpy as np
from numpy import nan

Expand Down
5 changes: 0 additions & 5 deletions pvlib/tests/iotools/test_srml.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from numpy import isnan
import pandas as pd
from pandas.util.testing import network
import pytest

from pvlib.iotools import srml
Expand All @@ -13,7 +12,6 @@ def test_read_srml():
srml.read_srml(srml_testfile)


@network
@pytest.mark.remote_data
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
def test_read_srml_remote():
Expand Down Expand Up @@ -66,7 +64,6 @@ def test_map_columns(column, expected):
assert srml.map_columns(column) == expected


@network
@pytest.mark.remote_data
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
def test_read_srml_month_from_solardat():
Expand All @@ -76,7 +73,6 @@ def test_read_srml_month_from_solardat():
assert file_data.equals(requested)


@network
@pytest.mark.remote_data
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
def test_15_minute_dt_index():
Expand All @@ -90,7 +86,6 @@ def test_15_minute_dt_index():
assert (data.index[3::4].minute == 45).all()


@network
@pytest.mark.remote_data
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
def test_hourly_dt_index():
Expand Down
2 changes: 0 additions & 2 deletions pvlib/tests/iotools/test_surfrad.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pandas as pd
from pandas.util.testing import network
import pytest

from pvlib.iotools import surfrad
Expand All @@ -10,7 +9,6 @@
'Alamosa_CO/2016/slv16001.dat')


@network
@pytest.mark.remote_data
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
def test_read_surfrad_network():
Expand Down
2 changes: 0 additions & 2 deletions pvlib/tests/iotools/test_tmy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from pandas.util.testing import network
import numpy as np
import pandas as pd
import pytest
Expand All @@ -17,7 +16,6 @@ def test_read_tmy3():
tmy.read_tmy3(TMY3_TESTFILE)


@network
@pytest.mark.remote_data
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
def test_read_tmy3_remote():
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/test_atmosphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from numpy import nan
from numpy.testing import assert_allclose
import pandas as pd
from pandas.util.testing import assert_series_equal
from pandas.testing import assert_series_equal
import pytest

from pvlib import atmosphere
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/test_clearsky.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import pytest
from numpy.testing import assert_allclose
from pandas.util.testing import assert_frame_equal, assert_series_equal
from pandas.testing import assert_frame_equal, assert_series_equal

from pvlib.location import Location
from pvlib import clearsky
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/test_iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pandas as pd

import pytest
from pandas.util.testing import assert_series_equal
from pandas.testing import assert_series_equal
from numpy.testing import assert_allclose

from pvlib import iam as _iam
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/test_inverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import pandas as pd

from pandas.util.testing import assert_series_equal
from pandas.testing import assert_series_equal
from numpy.testing import assert_allclose

from pvlib import inverter
Expand Down
12 changes: 4 additions & 8 deletions pvlib/tests/test_irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
import pytest
from numpy.testing import assert_almost_equal, assert_allclose

from pandas.util.testing import assert_frame_equal, assert_series_equal
from pandas.testing import assert_frame_equal, assert_series_equal

from pvlib import irradiance

from conftest import (needs_numpy_1_10, pandas_0_22,
requires_ephem, requires_numba)
from conftest import (needs_numpy_1_10, requires_ephem, requires_numba)


# fixtures create realistic test input data
Expand Down Expand Up @@ -237,11 +236,8 @@ def test_perez_components(irrad_data, ephem_data, dni_et, relative_airmass):
columns=['sky_diffuse', 'isotropic', 'circumsolar', 'horizon'],
index=irrad_data.index
)
if pandas_0_22():
expected_for_sum = expected['sky_diffuse'].copy()
expected_for_sum.iloc[2] = 0
else:
expected_for_sum = expected['sky_diffuse']
expected_for_sum = expected['sky_diffuse'].copy()
expected_for_sum.iloc[2] = 0
sum_components = out.iloc[:, 1:].sum(axis=1)
sum_components.name = 'sky_diffuse'

Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/test_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np
from numpy import nan
import pandas as pd
from pandas.util.testing import assert_frame_equal, assert_index_equal
from pandas.testing import assert_frame_equal, assert_index_equal

import pytest

Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/test_modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pvlib.location import Location
from pvlib._deprecation import pvlibDeprecationWarning

from pandas.util.testing import assert_series_equal
from pandas.testing import assert_series_equal
import pytest

from conftest import fail_on_pvlib_version, requires_scipy, requires_tables
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/test_pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pandas as pd

import pytest
from pandas.util.testing import assert_series_equal, assert_frame_equal
from pandas.testing import assert_series_equal, assert_frame_equal
from numpy.testing import assert_allclose

from pvlib import inverter, pvsystem
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/test_snow.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import pandas as pd

from pandas.util.testing import assert_series_equal
from pandas.testing import assert_series_equal

from pvlib import snow
from pvlib.tools import sind
Expand Down
12 changes: 2 additions & 10 deletions pvlib/tests/test_soiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
import datetime
import numpy as np
import pandas as pd
from pandas.util.testing import assert_series_equal
from pandas.testing import assert_series_equal
from pvlib.soiling import hsu, kimber
from pvlib.iotools import read_tmy3
from conftest import (
requires_scipy, needs_pandas_0_22, DATA_DIR)
from conftest import requires_scipy, DATA_DIR
import pytest


Expand Down Expand Up @@ -66,7 +65,6 @@ def rainfall_input():


@requires_scipy
@needs_pandas_0_22
def test_hsu_no_cleaning(rainfall_input, expected_output):
"""Test Soiling HSU function"""

Expand All @@ -84,7 +82,6 @@ def test_hsu_no_cleaning(rainfall_input, expected_output):


@requires_scipy
@needs_pandas_0_22
def test_hsu(rainfall_input, expected_output_2):
"""Test Soiling HSU function with cleanings"""

Expand All @@ -103,7 +100,6 @@ def test_hsu(rainfall_input, expected_output_2):


@requires_scipy
@needs_pandas_0_22
def test_hsu_defaults(rainfall_input, expected_output_1):
"""
Test Soiling HSU function with default deposition velocity and default rain
Expand All @@ -129,7 +125,6 @@ def expected_kimber_nowash():
parse_dates=True, index_col='timestamp')


@needs_pandas_0_22
def test_kimber_nowash(greensboro_rain, expected_kimber_nowash):
"""Test Kimber soiling model with no manual washes"""
# Greensboro typical expected annual rainfall is 8345mm
Expand All @@ -147,7 +142,6 @@ def expected_kimber_manwash():
parse_dates=True, index_col='timestamp')


@needs_pandas_0_22
def test_kimber_manwash(greensboro_rain, expected_kimber_manwash):
"""Test Kimber soiling model with a manual wash"""
# a manual wash date
Expand All @@ -171,7 +165,6 @@ def expected_kimber_norain():
return np.where(norain > max_loss_rate, max_loss_rate, norain)


@needs_pandas_0_22
def test_kimber_norain(greensboro_rain, expected_kimber_norain):
"""Test Kimber soiling model with no rain"""
# a year with no rain
Expand All @@ -193,7 +186,6 @@ def expected_kimber_initial_soil():
return np.where(norain > max_loss_rate, max_loss_rate, norain)


@needs_pandas_0_22
def test_kimber_initial_soil(greensboro_rain, expected_kimber_initial_soil):
"""Test Kimber soiling model with initial soiling"""
# a year with no rain
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/test_solarposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
import pandas as pd

from pandas.util.testing import assert_frame_equal, assert_series_equal
from pandas.testing import assert_frame_equal, assert_series_equal
from numpy.testing import assert_allclose
import pytest

Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/test_temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy as np

import pytest
from pandas.util.testing import assert_series_equal
from pandas.testing import assert_series_equal
from numpy.testing import assert_allclose

from pvlib import temperature
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/test_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pandas as pd

import pytest
from pandas.util.testing import assert_frame_equal
from pandas.testing import assert_frame_equal
from numpy.testing import assert_allclose

from pvlib.location import Location
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
URL = 'https://github.com/pvlib/pvlib-python'

INSTALL_REQUIRES = ['numpy >= 1.12.0',
'pandas >= 0.18.1',
'pandas >= 0.22.0',
'pytz',
'requests']
TESTS_REQUIRE = ['nose', 'pytest', 'pytest-cov', 'pytest-mock',
Expand Down