Hello,
I am new to STATA and I am trying to export a Python variable to Stata.
Below is my do-file:
clear
python:
import sklearn.datasets as skdata
import numpy as np
from sfi import Data
iris = skdata.load_iris()
from sklearn.naive_bayes import GaussianNB
GNB = GaussianNB()
GNB_fit = GNB.fit(iris.data, iris.target).predict(iris.data)
Data.addVarInt('GNB_fit')
Data.store('GNB_fit', None, GNB_fit)
end
When I execute above commands, the new variable GNB_fit appears in the list on the top right hand corner of the STATA window, but the variable does not contain any data.
How can I fix this issue?
Thank you,
Dominique
I am new to STATA and I am trying to export a Python variable to Stata.
Below is my do-file:
clear
python:
import sklearn.datasets as skdata
import numpy as np
from sfi import Data
iris = skdata.load_iris()
from sklearn.naive_bayes import GaussianNB
GNB = GaussianNB()
GNB_fit = GNB.fit(iris.data, iris.target).predict(iris.data)
Data.addVarInt('GNB_fit')
Data.store('GNB_fit', None, GNB_fit)
end
When I execute above commands, the new variable GNB_fit appears in the list on the top right hand corner of the STATA window, but the variable does not contain any data.
How can I fix this issue?
Thank you,
Dominique
Comment