Skip to content

API/PERF/BUG: infer dtypes when enlarging #9521

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

Closed
jreback opened this issue Feb 19, 2015 · 1 comment
Closed

API/PERF/BUG: infer dtypes when enlarging #9521

jreback opened this issue Feb 19, 2015 · 1 comment
Labels
API Design Bug Dtype Conversions Unexpected or buggy dtype conversions Performance Memory or execution speed performance

Comments

@jreback
Copy link
Contributor

jreback commented Feb 19, 2015

So this can be fixed by inferring after the set. We need to do this because we first set the value to a null-type (nan/NaT), then set the value. This works fine for datetime/timedelta/floats/strings, but not for integers which get set as float.

However, this can be an expensive operation as potentially the entire column needs to be scaned for nulls.

In [4]: df = pd.DataFrame()

In [5]: df.loc[1,'foo'] = 2

In [6]: df
Out[6]: 
   foo
1    2

In [7]: df.dtypes
Out[7]: 
foo    float64
dtype: object
@jreback jreback added Bug Performance Memory or execution speed performance Dtype Conversions Unexpected or buggy dtype conversions API Design labels Feb 19, 2015
@jreback jreback added this to the 0.17.0 milestone Feb 19, 2015
@jreback
Copy link
Contributor Author

jreback commented Feb 19, 2015

duped #6485

@jreback jreback closed this as completed Feb 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Bug Dtype Conversions Unexpected or buggy dtype conversions Performance Memory or execution speed performance
Projects
None yet
Development

No branches or pull requests

1 participant