-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DataFrame.delevel infer dtypes better #440
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
Labels
Milestone
Comments
wesm
added a commit
that referenced
this issue
Dec 2, 2011
wesm
added a commit
that referenced
this issue
Dec 2, 2011
Alright, I think I've got this working like it should. I also changed DataFrame.corr so it automatically excludes non-numeric dtypes per above. So |
Below an example of where after reset_index() (delevel() before) dtype could be float but object is used. In [36]: s
Out[36]:
time
0.0 0.0000
0.707106781187 2.4525
1.41421356237 9.8100
2.12132034356 22.0725
2.82842712475 39.2400
3.53553390593 61.3125
4.24264068712 88.2900
4.94974746831 120.1725
5.65685424949 156.9600
6.36396103068 198.6525
7.07106781187 245.2500
7.77817459305 296.7525
8.48528137424 353.1600
9.19238815543 414.4725
9.89949493661 480.6900
Name: speed
In [37]: df = s.reset_index()
In [38]: df
Out[38]:
time speed
0 0 0.0000
1 0.7071068 2.4525
2 1.414214 9.8100
3 2.12132 22.0725
4 2.828427 39.2400
5 3.535534 61.3125
6 4.242641 88.2900
7 4.949747 120.1725
8 5.656854 156.9600
9 6.363961 198.6525
10 7.071068 245.2500
11 7.778175 296.7525
12 8.485281 353.1600
13 9.192388 414.4725
14 9.899495 480.6900
In [39]: df['time'].dtype
Out[39]: dtype('object') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cc @lodagro
The text was updated successfully, but these errors were encountered: