You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.iloc returns object dtype for a non-object empty series:
In [1]: import pandas as pd
In [2]: df = pd.DataFrame({'a':[1,2,3],'b':['b','b2','b3']})
In [3]: df.ix[[],:].loc[:,'a']
Out[3]: Series([], name: a, dtype: int64)
In [4]: df.ix[[],:].iloc[:,0]
Out[4]: Series([], name: a, dtype: object)
@sinhrks It's a bit involved, but basically there as a function (to write to a table to a sql database) that takes in a dataframe and infers types from the columns. Sometimes people would like to pass in an empty dataframe in order to create an empty table.
.iloc
returnsobject
dtype for a non-object empty series:(came across this as I think it is related to the issue reported http://stackoverflow.com/questions/29749356/python-pandas-export-structure-only-no-rows-of-a-dataframe-to-sql/ , i.e. in sql code which is trying to infer series datatypes)
The text was updated successfully, but these errors were encountered: