Using python in D

rnd r_narang at yahoo.com
Fri Jun 7 03:50:34 UTC 2019


I have a simple python script file which contains following 3 
statements:

import pandas
df = pandas.read_csv('testfile.csv')
print(df[0:3])

Can I incorporate above in a D program?
I see there is pyd package for using python in D: 
https://code.dlang.org/packages/pyd
Will following program work:


import std.stdio;
import pyd.embedded;

void main(){
	py_import("pandas");
	py_stmts("df = pandas.read_csv('testfile.csv')"); 	
	py_stmts("print(df[0:3])");
}

Thanks for your insight.



More information about the Digitalmars-d-learn mailing list