We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
[X ] I have checked that this issue has not already been reported.
[ X] I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
di=np.array(['2016-12-27 02:02:09', '2016-12-27 02:02:09.017000', '2016-12-27 02:02:09.033000', '2016-12-27 02:02:09.050000', '2016-12-27 02:02:09.066000'],dtype='datetime64[ns]') di.setflags(write=False) v1=[95.746, 95.735, 95.722, 95.709, 10] v2=[-86.474, -86.491, -86.505, -86.513, 11] temp=pd.DataFrame({'v1':v1,'v2':v2}, index=di) temp=temp.astype('float64') temp2=temp.v1-temp.v2 temp2[temp2>180]=temp2[temp2>180]-360
This code throws an error:
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) ~/anaconda3/envs/mindsynchro/lib/python3.8/site-packages/pandas/core/series.py in __setitem__(self, key, value) 999 try: -> 1000 self._set_with_engine(key, value) 1001 except (KeyError, ValueError): ~/anaconda3/envs/mindsynchro/lib/python3.8/site-packages/pandas/core/series.py in _set_with_engine(self, key, value) 1032 # fails with AttributeError for IntervalIndex -> 1033 loc = self.index._engine.get_loc(key) 1034 validate_numeric_casting(self.dtype, value) pandas/_libs/index.pyx in pandas._libs.index.DatetimeEngine.get_loc() pandas/_libs/index.pyx in pandas._libs.index.DatetimeEngine.get_loc() TypeError: '2016-12-27 02:02:09.000 True 2016-12-27 02:02:09.017 True 2016-12-27 02:02:09.033 True 2016-12-27 02:02:09.050 True 2016-12-27 02:02:09.066 False dtype: bool' is an invalid key During handling of the above exception, another exception occurred: ValueError Traceback (most recent call last) <ipython-input-3-05bd4183267d> in <module> 8 temp=temp.astype('float64') 9 temp2=temp.v1-temp.v2 ---> 10 temp2[temp2>180]=temp2[temp2>180]-360 ~/anaconda3/envs/mindsynchro/lib/python3.8/site-packages/pandas/core/series.py in __setitem__(self, key, value) 1018 key = np.asarray(key, dtype=bool) 1019 try: -> 1020 self._where(~key, value, inplace=True) 1021 except InvalidIndexError: 1022 self.iloc[key] = value ~/anaconda3/envs/mindsynchro/lib/python3.8/site-packages/pandas/core/generic.py in _where(self, cond, other, inplace, axis, level, errors, try_cast) 8778 if other.ndim <= self.ndim: 8779 -> 8780 _, other = self.align( 8781 other, join="left", axis=axis, level=level, fill_value=np.nan 8782 ) ~/anaconda3/envs/mindsynchro/lib/python3.8/site-packages/pandas/core/series.py in align(self, other, join, axis, level, copy, fill_value, method, limit, fill_axis, broadcast_axis) 4272 broadcast_axis=None, 4273 ): -> 4274 return super().align( 4275 other, 4276 join=join, ~/anaconda3/envs/mindsynchro/lib/python3.8/site-packages/pandas/core/generic.py in align(self, other, join, axis, level, copy, fill_value, method, limit, fill_axis, broadcast_axis) 8557 ) 8558 elif isinstance(other, ABCSeries): -> 8559 return self._align_series( 8560 other, 8561 join=join, ~/anaconda3/envs/mindsynchro/lib/python3.8/site-packages/pandas/core/generic.py in _align_series(self, other, join, axis, level, copy, fill_value, method, limit, fill_axis) 8660 join_index, lidx, ridx = None, None, None 8661 else: -> 8662 join_index, lidx, ridx = self.index.join( 8663 other.index, how=join, level=level, return_indexers=True 8664 ) ~/anaconda3/envs/mindsynchro/lib/python3.8/site-packages/pandas/core/indexes/datetimelike.py in join(self, other, how, level, return_indexers, sort) 884 885 this, other = self._maybe_utc_convert(other) --> 886 return Index.join( 887 this, 888 other, ~/anaconda3/envs/mindsynchro/lib/python3.8/site-packages/pandas/core/indexes/base.py in join(self, other, how, level, return_indexers, sort) 3500 elif self.is_monotonic and other.is_monotonic: 3501 try: -> 3502 return self._join_monotonic( 3503 other, how=how, return_indexers=return_indexers 3504 ) ~/anaconda3/envs/mindsynchro/lib/python3.8/site-packages/pandas/core/indexes/base.py in _join_monotonic(self, other, how, return_indexers) 3800 join_index = self 3801 lidx = None -> 3802 ridx = self._left_indexer_unique(sv, ov) 3803 elif how == "right": 3804 join_index = other ~/anaconda3/envs/mindsynchro/lib/python3.8/site-packages/pandas/core/indexes/datetimelike.py in wrapper(left, right) 62 right = right.view("i8") 63 ---> 64 results = joinf(left, right) 65 if with_indexers: 66 # dtype should be timedelta64[ns] for TimedeltaIndex pandas/_libs/join.pyx in pandas._libs.join.left_join_indexer_unique() ~/anaconda3/envs/mindsynchro/lib/python3.8/site-packages/pandas/_libs/join.cpython-38-x86_64-linux-gnu.so in View.MemoryView.memoryview_cwrapper() ~/anaconda3/envs/mindsynchro/lib/python3.8/site-packages/pandas/_libs/join.cpython-38-x86_64-linux-gnu.so in View.MemoryView.memoryview.__cinit__() ValueError: buffer source array is read-only
pd.show_versions()
INSTALLED VERSIONS commit : db08276 python : 3.8.6.final.0 python-bits : 64 OS : Linux OS-release : 4.15.0-118-generic Version : #119-Ubuntu SMP Tue Sep 8 12:30:01 UTC 2020 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8
pandas : 1.1.3 numpy : 1.19.2 pytz : 2020.1 dateutil : 2.8.1 pip : 20.2.3 setuptools : 49.6.0.post20201009 Cython : 0.29.21 lxml.etree : 4.5.2 jinja2 : 2.11.2 IPython : 7.18.1 fsspec : 0.8.4 fastparquet : 0.4.1 matplotlib : 3.3.2 pyarrow : 0.17.1 scipy : 1.5.2 xarray : 0.16.1 numba : 0.51.2
The text was updated successfully, but these errors were encountered:
Any movement on this? It's still marked as 'Needs Triage'?
Sorry, something went wrong.
did u try on master?
Successfully merging a pull request may close this issue.
[X ] I have checked that this issue has not already been reported.
[ X] I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
This code throws an error:
Problem description
Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : db08276
python : 3.8.6.final.0
python-bits : 64
OS : Linux
OS-release : 4.15.0-118-generic
Version : #119-Ubuntu SMP Tue Sep 8 12:30:01 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.1.3
numpy : 1.19.2
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.3
setuptools : 49.6.0.post20201009
Cython : 0.29.21
lxml.etree : 4.5.2
jinja2 : 2.11.2
IPython : 7.18.1
fsspec : 0.8.4
fastparquet : 0.4.1
matplotlib : 3.3.2
pyarrow : 0.17.1
scipy : 1.5.2
xarray : 0.16.1
numba : 0.51.2
The text was updated successfully, but these errors were encountered: