-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: astype assignment via iloc/loc not working #4312
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
Comments
@jreback is this fixed or did you want to raise? In [10]: df = pd.DataFrame({'A': [1., 2., 3., 4.]})
In [11]: df.dtypes
Out[11]:
A float64
dtype: object
In [12]: df.loc[:, 'A'] = df['A'].astype(np.int64)
In [13]: df.dtypes
Out[13]:
A float64
dtype: object
In [14]: pd.__version__
Out[14]: '0.13.0rc1-27-g4d5ca5c' I think this is still the same. |
Ah, I guess it's just |
hmm thought all those cases were tested can u create a new issue pls |
Hello Guys, |
Hi, df.iloc[:, 0:30] = df.iloc[:, 0:30].astype(int) => does not work ... df.iloc[:, 0] = df.iloc[:, 0].astype(int) ... df.loc[:, "first_col"] = df.loc[:, "first_col"].astype(int) ... df.iloc[:, 0:30].astype(int).dtypes => shows all columns to "int32" |
http://stackoverflow.com/questions/17778139/pandas-unable-to-change-column-data-type/17778560#17778560
This might be trying to coerce
object
dtype to a real dtype (int/float) and is failingShould prob raise for now (or work). Not working with iloc/loc.
The text was updated successfully, but these errors were encountered: