@@ -1275,15 +1275,7 @@ def set_data(new_data, model=None):
1275
1275
1276
1276
for variable_name , new_value in new_data .items ():
1277
1277
if isinstance (model [variable_name ], SharedVariable ):
1278
- if hasattr (new_value , "dtype" ):
1279
- # if no dtype given but available as attr of value, use that as dtype
1280
- dtype = new_value .dtype
1281
- elif isinstance (new_value , int ):
1282
- dtype = int
1283
- else :
1284
- # otherwise, assume float
1285
- dtype = float
1286
- model [variable_name ].set_value (pandas_to_array (new_value , dtype = dtype ))
1278
+ model [variable_name ].set_value (pandas_to_array (new_value ))
1287
1279
else :
1288
1280
message = 'The variable `{}` must be defined as `pymc3.' \
1289
1281
'Data` inside the model to allow updating. The ' \
@@ -1490,7 +1482,7 @@ def init_value(self):
1490
1482
return self .tag .test_value
1491
1483
1492
1484
1493
- def pandas_to_array (data , dtype = float ):
1485
+ def pandas_to_array (data ):
1494
1486
if hasattr (data , 'values' ): # pandas
1495
1487
if data .isnull ().any ().any (): # missing values
1496
1488
ret = np .ma .MaskedArray (data .values , data .isnull ().values )
@@ -1510,12 +1502,7 @@ def pandas_to_array(data, dtype=float):
1510
1502
else :
1511
1503
ret = np .asarray (data )
1512
1504
1513
- if dtype in [int , np .int8 , np .int16 , np .int32 , np .int64 ]:
1514
- return pm .intX (ret )
1515
- elif dtype in [float , np .float16 , np .float32 , np .float64 ]:
1516
- return pm .floatX (ret )
1517
- else :
1518
- raise ValueError ('Unsupported type for pandas_to_array: %s' % str (dtype ))
1505
+ return ret
1519
1506
1520
1507
1521
1508
def as_tensor (data , name , model , distribution ):
0 commit comments