I have been working Python pandas DF. I usually Load a csv files, but at the same time I have excel files too. I find out pandas is very slow reading Excel files. I have JavaScript code that will convert from excel to csv. I am looking to way calling this script to automating conversion to csv to speed the pipeline. Basically do conversion behind scene. What is the best way to do this? I can share JS code anytime.
- Do you have a way of running it from the command line?– Ami TavoryCommentedMar 10, 2016 at 15:28
- @AmiTavory Unfortunately no, I using Anaconda spyder (Python 3.5)– mtkilicCommentedMar 10, 2016 at 15:31
- I assume you've found this answer: stackoverflow.com/a/8284932/5276797.– IanSCommentedMar 10, 2016 at 15:39
- Or better this one: stackoverflow.com/a/10136615/5276797– IanSCommentedMar 10, 2016 at 15:45
- @IanS I did found both of them. I am taking another look in PyV8, but still not sure if this will solve my problem. Thank you– mtkilicCommentedMar 10, 2016 at 15:47
2 Answers
start node app from python script explains how to use python
subprocess
to run a node.js
script.
node.js
runs javascript
code on a v8
(chrome) engine. It's is easy to install on both Linux and Windows. There's an active SO tag, https://stackoverflow.com/questions/tagged/node.js
I like coffeescript
as a way of writing javascript
code with a syntax that is much more like Python.
I've see Python web stack questions (e.g. django
) that talk about running javascript
, though that might be on the client side rather than the serve.
I follow subprocess method and it worked perfectly for me. Here is what I added to my code, order to run javascript code from python.
Import subprocess subprocess.check_call(["cscript", "yourjsfile.js"])