Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit ae3233b

Browse files
PokhodenkoSARubtsowaakharche
authored
Update pandas 1.0.5 (#905)
* Update Pandas 1.0.5 (#899) * Update Pandas 1.0.5 * Skip failed tests with Pandas 1.0 * fix rolling count (#900) * fix rolling count * add if in gen_impl * fix rolling.count * fix rolling apply mean (#902) * fix test_series_getitem_idx_bool_array2 (#903) * Fix RangeIndex tests (#904) * fix tests for series (#907) * Remove skip_pandas1 decorator (#909) Co-authored-by: Rubtsowa <36762665+Rubtsowa@users.noreply.github.com> Co-authored-by: Angelina Kharchevnikova <angelina.kharchevnikova@intel.com>
1 parent a71cda9 commit ae3233b

8 files changed

Lines changed: 31 additions & 25 deletions

File tree

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ Distribution includes Intel® SDC for Python 3.6 and Python 3.7 for Windows and
3434

3535
Intel® SDC conda package can be installed using the steps below::
3636

37-
> conda create -n sdc-env python=<3.7 or 3.6> pyarrow=0.17.0 pandas=0.25.3 -c anaconda -c conda-forge
37+
> conda create -n sdc-env python=<3.7 or 3.6> pyarrow=0.17.0 pandas=1.0.5 -c anaconda -c conda-forge
3838
> conda activate sdc-env
3939
> conda install sdc -c intel/label/beta -c intel -c defaults -c conda-forge --override-channels
4040

4141
Intel® SDC wheel package can be installed using the steps below::
4242

43-
> conda create -n sdc-env python=<3.7 or 3.6> pip pyarrow=0.17.0 pandas=0.25.3 -c anaconda -c conda-forge
43+
> conda create -n sdc-env python=<3.7 or 3.6> pip pyarrow=0.17.0 pandas=1.0.5 -c anaconda -c conda-forge
4444
> conda activate sdc-env
4545
> pip install --index-url https://pypi.anaconda.org/intel/label/beta/simple --extra-index-url https://pypi.anaconda.org/intel/simple --extra-index-url https://pypi.org/simple sdc
4646

@@ -82,7 +82,7 @@ Building on Linux with setuptools
8282

8383
export PYVER=<3.6 or 3.7>
8484
export NUMPYVER=<1.16 or 1.17>
85-
conda create -n sdc-env -q -y -c intel/label/beta -c defaults -c intel -c conda-forge python=$PYVER numpy=$NUMPYVER tbb-devel tbb4py numba=0.49 pandas=0.25.3 pyarrow=0.17.0 gcc_linux-64 gxx_linux-64
85+
conda create -n sdc-env -q -y -c intel/label/beta -c defaults -c intel -c conda-forge python=$PYVER numpy=$NUMPYVER tbb-devel tbb4py numba=0.49 pandas=1.0.5 pyarrow=0.17.0 gcc_linux-64 gxx_linux-64
8686
source activate sdc-env
8787
git clone https://github.com/IntelPython/sdc.git
8888
cd sdc
@@ -120,7 +120,7 @@ Building on Windows with setuptools
120120

121121
set PYVER=<3.6 or 3.7>
122122
set NUMPYVER=<1.16 or 1.17>
123-
conda create -n sdc-env -c intel/label/beta -c defaults -c intel -c conda-forge python=%PYVER% numpy=%NUMPYVER% tbb-devel tbb4py numba=0.49 pandas=0.25.3 pyarrow=0.17.0
123+
conda create -n sdc-env -c intel/label/beta -c defaults -c intel -c conda-forge python=%PYVER% numpy=%NUMPYVER% tbb-devel tbb4py numba=0.49 pandas=1.0.5 pyarrow=0.17.0
124124
conda activate sdc-env
125125
set INCLUDE=%INCLUDE%;%CONDA_PREFIX%\Library\include
126126
set LIB=%LIB%;%CONDA_PREFIX%\Library\lib

conda-recipe/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% set NUMBA_VERSION = "==0.50.1" %}
2-
{% set PANDAS_VERSION = "==0.25.3" %}
2+
{% set PANDAS_VERSION = "==1.0.5" %}
33
{% set PYARROW_VERSION = "==0.17.0" %}
44

55
package:

sdc/datatypes/hpat_pandas_series_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def hpat_pandas_series_getitem_idx_slice_impl(self, idx):
407407
def hpat_pandas_series_getitem_idx_list_impl(self, idx):
408408

409409
if len(self) != len(idx):
410-
raise IndexError("Item wrong length")
410+
raise IndexError('Boolean index has wrong length')
411411

412412
return pandas.Series(
413413
data=numpy_like.getitem_by_mask(self._data, idx),

sdc/datatypes/hpat_pandas_series_rolling_functions.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -235,21 +235,24 @@ def put_corr(x, y, nfinite, result):
235235

236236

237237
@sdc_register_jitable
238-
def pop_count(value, nfinite, result):
238+
def pop_count(value, counter, result):
239239
"""Calculate the window count without old value."""
240240
if numpy.isnan(value):
241-
return nfinite, result
241+
return counter, result
242242

243-
return nfinite, result - 1
243+
return counter, result - 1
244244

245245

246246
@sdc_register_jitable
247-
def put_count(value, nfinite, result):
247+
def put_count(value, counter, result):
248248
"""Calculate the window count with new value."""
249+
# rolling.count() fills front of the resulting array by nans according to min_periods using counter
250+
# Ex: s = pd.Series([1, 2, np.nan]) -> s.rolling(window=3, min_periods=2).count() -> pd.Series([np.nan, 2.0, 2.0])
251+
counter += 1
249252
if numpy.isnan(value):
250-
return nfinite, result
253+
return counter, result
251254

252-
return nfinite, result + 1
255+
return counter, result + 1
253256

254257

255258
@sdc_register_jitable
@@ -731,7 +734,7 @@ def impl(self, ddof=1):
731734

732735

733736
sdc_pandas_series_rolling_count_impl = gen_sdc_pandas_series_rolling_impl(
734-
pop_count, put_count, get_result=result, init_result=0.)
737+
pop_count, put_count, init_result=0.)
735738
sdc_pandas_series_rolling_kurt_impl = gen_sdc_pandas_series_rolling_impl(
736739
pop_kurt, put_kurt, get_result=kurt_result_or_nan,
737740
init_result=(0., 0., 0., 0.))
@@ -771,8 +774,7 @@ def hpat_pandas_rolling_series_apply_impl(self, func, raw=None):
771774
output_arr = numpy.empty(length, dtype=float64)
772775

773776
def culc_apply(arr, func, minp):
774-
finite_arr = arr.copy()
775-
finite_arr[numpy.isinf(arr)] = numpy.nan
777+
finite_arr = arr[numpy.isfinite(arr)]
776778
if len(finite_arr) < minp:
777779
return numpy.nan
778780
else:

sdc/extensions/indexes/range_index_ext.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def pd_range_index_overload(start=None, stop=None, step=None, dtype=None, copy=F
9797
raise SDCLimitation(f"{_func_name} Unsupported parameter. Given 'fastpath': {fastpath}")
9898

9999
dtype_is_np_int64 = dtype is types.NumberClass(types.int64)
100+
dtype_is_np_int32 = dtype is types.NumberClass(types.int32)
100101
dtype_is_unicode_str = isinstance(dtype, (types.UnicodeType, types.StringLiteral))
101102
if not _check_dtype_param_type(dtype):
102103
ty_checker.raise_exc(dtype, 'int64 dtype', 'dtype')
@@ -125,9 +126,12 @@ def pd_range_index_ctor_impl(start=None, stop=None, step=None, dtype=None, copy=
125126

126127
if not (dtype is None
127128
or dtype_is_unicode_str and dtype == 'int64'
128-
or dtype_is_np_int64):
129-
raise TypeError("Invalid to pass a non-int64 dtype to RangeIndex")
129+
or dtype_is_unicode_str and dtype == 'int32'
130+
or dtype_is_np_int64
131+
or dtype_is_np_int32):
132+
raise ValueError("Incorrect `dtype` passed: expected signed integer")
130133

134+
# TODO: add support of int32 type
131135
_start = types.int64(start) if start is not None else types.int64(0)
132136

133137
if stop is None:

sdc/tests/test_indexes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def test_impl(stop, dtype):
195195
sdc_func = self.jit(test_impl)
196196

197197
n = 11
198-
supported_dtypes = [None, np.int64, 'int64']
198+
supported_dtypes = [None, np.int64, 'int64', np.int32, 'int32']
199199
for dtype in supported_dtypes:
200200
with self.subTest(dtype=dtype):
201201
result = sdc_func(n, dtype)
@@ -208,7 +208,7 @@ def test_impl(stop, dtype):
208208
sdc_func = self.jit(test_impl)
209209

210210
n = 11
211-
invalid_dtypes = ['float', np.int32, 'int32']
211+
invalid_dtypes = ['float']
212212
for dtype in invalid_dtypes:
213213
with self.subTest(dtype=dtype):
214214
with self.assertRaises(Exception) as context:

sdc/tests/test_series.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def series_values_from_argsort_result(series, argsorted):
148148
def restore_series_sort_values(series, my_result_index, ascending):
149149
value_dict = {}
150150
nan_list = []
151-
data = np.copy(series.data)
151+
data = np.copy(series.values)
152152
index = np.copy(series.index)
153153
for value in range(len(data)):
154154
# if np.isnan(data[value]):
@@ -996,7 +996,7 @@ def test_impl(A, i):
996996
S = pd.Series(np.arange(n), name='A')
997997
# SDC and pandas results differ due to type limitation requirements:
998998
# SDC returns Series of one element, whereas pandas returns scalar, hence we align result
999-
result = hpat_func(S, i).data[0]
999+
result = hpat_func(S, i).values[0]
10001000
result_ref = test_impl(S, i)
10011001
self.assertEqual(result, result_ref)
10021002

@@ -1096,7 +1096,7 @@ def test_impl(S, key):
10961096
indices = [[2, 3, 5], [2, 3, 5], [2, 3, 5]]
10971097
for key, index in zip(keys, indices):
10981098
S = pd.Series([11, 22, 33], index, name='A')
1099-
np.testing.assert_array_equal(jit_impl(S, key).data, np.array(test_impl(S, key)))
1099+
np.testing.assert_array_equal(jit_impl(S, key).values, np.array(test_impl(S, key)))
11001100

11011101
def test_series_getitem_duplicate_index(self):
11021102
def test_impl(A):
@@ -1162,7 +1162,7 @@ def test_impl(S, key):
11621162
indices = [[2, 3, 5], [2, 2, 2], [2, 4, 15]]
11631163
for key, data, index in zip(keys, all_data, indices):
11641164
S = pd.Series(data, index, name='A')
1165-
np.testing.assert_array_equal(jit_impl(S, key).data, np.array(test_impl(S, key)))
1165+
np.testing.assert_array_equal(jit_impl(S, key).values, np.array(test_impl(S, key)))
11661166

11671167
def test_series_loc_str(self):
11681168
def test_impl(A):
@@ -4048,7 +4048,7 @@ def test_impl(series, ascending, kind):
40484048
if kind == 'mergesort':
40494049
pd.testing.assert_series_equal(ref_result, jit_result)
40504050
else:
4051-
np.testing.assert_array_equal(ref_result.data, jit_result.data)
4051+
np.testing.assert_array_equal(ref_result.values, jit_result.values)
40524052
self.assertEqual(ref, jit)
40534053

40544054
@skip_parallel

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def run(self):
373373
package_data={'sdc.tests': ['*.bz2'], },
374374
install_requires=[
375375
'numpy>=1.16',
376-
'pandas==0.25.3',
376+
'pandas>=1.0',
377377
'pyarrow==0.17.0',
378378
'numba>=0.50.1,<0.51',
379379
'tbb'

0 commit comments

Comments
 (0)