I'm facing the issue when passing list from Python to Javascript. I need to loop the python list in javascript to get each element of the list. So, could you please help me out with how to dynamically loop the list to get all the values from the df or is there any other way to achieve it.
Below is the code: .PY file:
df = pd.read_csv('os.csv')
df = df.fillna('-')
df = df.values.tolist()
return render_template('pdf_test.html',df = df)
python output: df = [['OS Version', 'Red Hat Enterprise Linux Server 7.6 (Maipo)'], ['OS Kernel Version', '3.10.0-957.97.1.el7.x86_64']]
Javascript
<script type="text/javascript">
function saveDiv()
{
var df1 = '{{df[0]}}'; //it returns first index of the list.How to dynamically loop the list to get all the values from the df.
}
</script>