Skip to content
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

adding new row to frame breaks types #9269

Closed
behzadnouri opened this issue Jan 16, 2015 · 5 comments
Closed

adding new row to frame breaks types #9269

behzadnouri opened this issue Jan 16, 2015 · 5 comments
Labels
Dtype Conversions Unexpected or buggy dtype conversions Duplicate Report Duplicate issue or pull request Enhancement Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

Comments

@behzadnouri
Copy link
Contributor

xref #8596

>>> df
   a
0  1
>>> df.dtypes
a    int64
dtype: object
>>> df.loc[1, 'a'] = 2
>>> df
   a
0  1
1  2
>>> df.dtypes
a    float64
dtype: object

in an intermediate step nan is inserted, and the data are casted to floats

@jreback
Copy link
Contributor

jreback commented Jan 16, 2015

type conversion is not done here. as it can be expensive. imagine doing this repeatedly (not recommended anyhow).

This is a side-effect of this type of enlargement. a user can use concat if they want type preservation. However, you can fix the impl to avoid the 2-step creation with missing then filling.

Is that the intention here? as an enhnacement?

@jreback jreback added Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Docs Dtype Conversions Unexpected or buggy dtype conversions and removed Docs labels Jan 16, 2015
@behzadnouri
Copy link
Contributor Author

agreed that a code change to handle this should not be expensive in terms of performance cost; added the issue just because #8596 is a similar issue, so there may be a solution which works for both cases.

@jreback jreback added this to the 0.16.0 milestone Jan 16, 2015
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 5, 2015
@goretkin
Copy link

can concat guarantee that the new row is added in-place?

@shoyer
Copy link
Member

shoyer commented Sep 30, 2016

can concat guarantee that the new row is added in-place?

concat never updates in-place.

@jorisvandenbossche
Copy link
Member

This actually seems a duplicate of #6485 (BUG/ENH: dtype change on enlargement).

@jorisvandenbossche jorisvandenbossche modified the milestones: No action, Next Major Release Sep 30, 2016
@jorisvandenbossche jorisvandenbossche added the Duplicate Report Duplicate issue or pull request label Sep 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions Duplicate Report Duplicate issue or pull request Enhancement Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
Development

No branches or pull requests

5 participants