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
I have found this while working with period-indexed data frames on Windows XP 32 bits:
import numpy as np
import pandas as pd
index = pd.period_range(start='1999-01', periods=5, freq='M')
s1 = pd.Series(np.random.rand(len(index)), index=index)
s2 = pd.Series(np.random.rand(len(index)), index=index)
series = [('s1', s1), ('s2',s2)]
df = pd.DataFrame.from_items(series)
grouped = df.groupby(df.index.month)
list(grouped)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Python27\lib\site-packages\pandas\core\groupby.py", line 595, in get_iterator
for key, (i, group) in izip(keys, splitter):
File "D:\Python27\lib\site-packages\pandas\core\groupby.py", line 2214, in __iter__
sdata = self._get_sorted_data()
File "D:\Python27\lib\site-packages\pandas\core\groupby.py", line 2231, in _get_sorted_data
return self.data.take(self.sort_idx, axis=self.axis)
File "D:\Python27\lib\site-packages\pandas\core\frame.py", line 2891, in take
new_index = self.index.take(indices)
File "D:\Python27\lib\site-packages\pandas\tseries\period.py", line 1110, in take
taken = self.values.take(indices, axis=axis)
TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
This happens with the last stable version 0.11.0. However iterating over grouped.s1 or grouped.s2 just works.
The text was updated successfully, but these errors were encountered:
See the docs for numpy.ndarray.astype for why this is happening. Let d1 and d2 be two dtypes. array([1,2], d1).astype(d2, cast='safe') will not work if d1.itemsize > d2.itemsize because 'safe' implies that you are not okay with losing information when casting from d1 to d2. You are on a 32-bit system and it sounds like there is no 64-bit integer emulation on your OS.
@cpcloud this might be a bug I have to look
period index is backed by int64, by there are conversions necessary at times to platform int
(which should be transparent)
I have found this while working with period-indexed data frames on Windows XP 32 bits:
This happens with the last stable version 0.11.0. However iterating over grouped.s1 or grouped.s2 just works.
The text was updated successfully, but these errors were encountered: