setting a dataframe row with .ix with columns of different datatypes

94 views
Skip to first unread message

Tiago Requeijo

unread,
Jun 5, 2012, 5:36:09 PM6/5/12
to pyd...@googlegroups.com
Hi,

It seems that doing 

df.ix[label] = [... values ...]

only works when the columns are of similar datatypes. For example

import pandas


data = pandas.DataFrame.from_dict({1: [1,2,3], 2: [3,4,5]})

print data.dtypes

data.ix[1] = [10, 20] # works

print data

print


data = pandas.DataFrame.from_dict({1: [1.,2.,3.], 2: [3.,4.,5.]})

print data.dtypes

data.ix[1] = [10., 20.] # works

print data

print


data = pandas.DataFrame.from_dict({1: [1.,2.,3.], 2: [3,4,5]})

print data.dtypes

data.ix[1] = [10., 20] # fails

print data

print


Is this intended?



Thanks,


Tiago


Wouter Overmeire

unread,
Jun 8, 2012, 11:29:25 AM6/8/12
to pyd...@googlegroups.com


2012/6/5 Tiago Requeijo <tiago.r...@gmail.com>

I opened an issue for this https://github.com/pydata/pandas/issues/1432.

Wes McKinney

unread,
Jun 12, 2012, 5:51:08 PM6/12/12
to pyd...@googlegroups.com
This has been fixed
Reply all
Reply to author
Forward
0 new messages