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

Inconsistant datatype with type()? #11969

Closed
grgsolymosi opened this issue Jan 6, 2016 · 9 comments
Closed

Inconsistant datatype with type()? #11969

grgsolymosi opened this issue Jan 6, 2016 · 9 comments
Labels
Dtype Conversions Unexpected or buggy dtype conversions Duplicate Report Duplicate issue or pull request

Comments

@grgsolymosi
Copy link

[in]

for cl in train.columns:
     print cl, type(train.loc[0, cl])
     print cl, type(train[cl][0])
     break

[out]

record_ID <type 'numpy.float64'> 
record_ID <type 'numpy.int64'>

Though I can solve it in many cases with train[cl].dtype, which gives the correct output:

[out]

record_ID int64

But if we work with string data types the output will be object instead of str as data type.

Something shortstop by me or what happens?
Thank you.

@jreback
Copy link
Contributor

jreback commented Jan 6, 2016

pls show train.info(), train.head() and pd.show_versions()

@jreback jreback added Dtype Conversions Unexpected or buggy dtype conversions Usage Question labels Jan 6, 2016
@jorisvandenbossche
Copy link
Member

A smaller reproducible example:


In [5]: df = pd.DataFrame({'a':[0,1,2], 'b':[0.1,0.2,0.3]})

In [6]: df
Out[6]:
   a    b
0  0  0.1
1  1  0.2
2  2  0.3

In [7]: type(df.loc[0, 'a'])
Out[7]: numpy.float64

In [8]: type(df['a'][0])
Out[8]: numpy.int64

@jreback
Copy link
Contributor

jreback commented Jan 6, 2016

dupe of #11617

@jreback jreback closed this as completed Jan 6, 2016
@jreback jreback added the Duplicate Report Duplicate issue or pull request label Jan 6, 2016
@jorisvandenbossche jorisvandenbossche added this to the No action milestone Jan 6, 2016
@grgsolymosi
Copy link
Author

@jreback0
Why the "dupe" label, please?
@jorisvandenbossche 's example shows the same issue, doesn't it?

@jreback
Copy link
Contributor

jreback commented Jan 6, 2016

dupe means duplicate. See the referenced issue which is the same. We get a fair number of duplicates here (no fault of the poster of course). So try to have a single issue.

If you look at the referenced issue and it IS not the same, pls let me know.

@grgsolymosi
Copy link
Author

@jreback thank you for the info and your efforts.

@grgsolymosi
Copy link
Author

@jreback
Just one more info as I saw, that the other issue was on other system config:
My system:
Python 2.7.11
Ubuntu 14.04 LTS

@jreback
Copy link
Contributor

jreback commented Jan 6, 2016

@temmplar ok, these ops are not system dependent. but thanks for the info.

@grgsolymosi
Copy link
Author

@jreback Furthermore I have some other additional info, which maybe would be a help to backcode the bug, if you need it, please contact me.

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
Projects
None yet
Development

No branches or pull requests

3 participants