File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1675,6 +1675,11 @@ def init_value(self):
1675
1675
1676
1676
1677
1677
def pandas_to_array (data ):
1678
+ """Convert a Pandas object to a NumPy array.
1679
+
1680
+ XXX: When `data` is a generator, this will return a Theano tensor!
1681
+
1682
+ """
1678
1683
if hasattr (data , "values" ): # pandas
1679
1684
if data .isnull ().any ().any (): # missing values
1680
1685
ret = np .ma .MaskedArray (data .values , data .isnull ().values )
@@ -1776,7 +1781,10 @@ def __init__(
1776
1781
1777
1782
if type is None :
1778
1783
data = pandas_to_array (data )
1779
- type = TensorType (distribution .dtype , data .shape )
1784
+ if isinstance (data , theano .gof .graph .Variable ):
1785
+ type = data .type
1786
+ else :
1787
+ type = TensorType (distribution .dtype , data .shape )
1780
1788
1781
1789
self .observations = data
1782
1790
You can’t perform that action at this time.
0 commit comments