Created
March 14, 2015 05:01
-
-
Save lateefj/f9e8e0d93058af034c68 to your computer and use it in GitHub Desktop.
Python wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import python | |
type | |
Digits = object of RootObj | |
#data: seq[seq[int]] | |
target: seq[int] | |
Py_Initialize() | |
var dsModule = PyImport_ImportModule("sklearn.datasets") | |
var pyTarget = PyObject_GetItem(dsModule, PyString_FromString("target")) | |
let targetSize = PyList_Size(pyTarget) | |
echo("Size of targets ", targetSize) | |
var target = newSeq[int64]() | |
for i in 0..targetSize: | |
target.insert(PyLong_AsLongLong(PyList_GetItem(pyTarget,i)), i) | |
echo("target: ", target) | |
Py_XDECREF(dsModule) | |
Py_Finalize() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment