[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.

Comment From: jreback

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

Comment From: jorisvandenbossche

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

Comment From: jreback

dupe of #11617

Comment From: grgsolymosi

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

Comment From: jreback

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.

Comment From: grgsolymosi

@jreback thank you for the info and your efforts.

Comment From: grgsolymosi

@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

Comment From: jreback

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

Comment From: grgsolymosi

@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.