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.
Asked
Active
Viewed 714 times
0
-
Do you have a way of running it from the command line? – Ami Tavory Mar 10 '16 at 15:28
-
@AmiTavory Unfortunately no, I using Anaconda spyder (Python 3.5) – mtkilic Mar 10 '16 at 15:31
-
I assume you've found this answer: http://stackoverflow.com/a/8284932/5276797. – IanS Mar 10 '16 at 15:39
-
Or better this one: http://stackoverflow.com/a/10136615/5276797 – IanS Mar 10 '16 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 – mtkilic Mar 10 '16 at 15:47
-
I did not benchmark it, but `xlrd` is supposed to be faster https://pypi.python.org/pypi/xlrd – Leb Mar 10 '16 at 15:48
-
@Leb I testing that now. Thank you – mtkilic Mar 10 '16 at 16:56
2 Answers
1
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.
0
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"])

mtkilic
- 1,213
- 1
- 12
- 28