I am using Scikit-Learn and Pandas libraries of Python for Data Analysis.
How to interface Python with data visualization tools such as Qlikview?
There's no straightforward route to calling Python from QlikView. I have used this:
Create a Python program that outputs CSV (or any file format that QlikView can read)
Invoke your Python program from the QlikView script: EXEC python3 my_program.py > my_output.csv
Read the output into QlikView: LOAD * FROM my_output.csv (...)
Note that the EXEC command requires the privilege "Can Execute External Programs" on the Settings tab of the script editor.
This link shows you how to integrate Qlikview and Python https://community.qlik.com/docs/DOC-14011
Related
I learnt data manipulation and analysis through Stata and I used the log command to record all the commands written and the output generated. Doing so I could reproduce my findings, check previous results and share it with others in pdf or txt. What to use with Python? Is there a difference if I use a Python Jupyter Notebook or Spyder?
The way to do what you want is by using the %logstart command, as described here:
Log IPython output?
Stop using the python interpreter and start storing your commands in a text file before running them. This way you will be able to share, reuse, and revise your python code.
By executing the following command:
python code.txt
Python will read all of the lines in your file sequentially.
This is the main way python programs are executed, as a convention, python code files end with .py , so if you see a file with a .py extension, you can try executing it yourself using this method!
I need to convert a vtk file into json file in the back-end of a server (e.g subprocess). Therefore, I would like to create a script (e.g. python) I can call and run from remote. Are there any tutorial for that ?
Thank you !
Regards
Start by running blender from your script/process with the background mode argument --background. You can follow that with a python script with the --python <script.py> argument. You may find this question on how to pass arguments to a script interesting.
blender --background --python export_to_json.py
You already know where to get the info for importing VTK. If you don't know, the three.js project has a blender exporter that uses JSON.
The script you make would use the following two commands to do the import and export -
VTKBlender.PolyDataMapperToBlender.convert(pmapper, me=None)
bpy.ops.export.three(filepath=outfile)
I have OpenFOAM solution file obtained on HPC (cluster computer system) in which I have no GUI access. I have Python code that works on Python Shell of ParaView without any problem but I need to open ParaView to use the code. I want to run this Python code on HPC and calculate some parameters using ParaView Python ability. Is it possible to do this without activating GUI of ParaView?
Yes of course. You can generate a python trace in ParaView (Tools-> Start Trace). This will help you find out what code you are missing :
from paraview.simple import *
casefoam = OpenFOAMReader(FileName='/path/to/case.foam')
casefoam.MeshRegions = ['internalMesh']
casefoam.CellArrays = ['U']
casefoam.CaseType = 'Decomposed Case'
etc....
Then you can use the pvbatch utility to run this. However, if you are going to run it on a cluster environment where the nodes don't have access to X then you need to make sure pvbatch was compiled with off-screen rendering capability using either EGL or OSMesa.
I would like to generate pdf files using Scribus and python scripting. I have been looking around and have found just examples of python scripts using scribus module within Scirbus. And commentary in these scripts, that
"This Python script is written for the Scribus scripting interface.
It can only be run from within Scribus."
When I am using command
import scribus
In python, an error occurs ImportError: No module named 'scribus'. But when I am using this command within python console in Scribus, everything is ok and I can use this module. So, Where can I found this module?
Or can I run Scribus with input parametr as python script? Something like
scribus python_script.py
I am using both linux and windows, so solution in one of these os will be great.
Python 3.3.2 &
Scribus 1.4.3
In fact you can pass a python script as argument to scribus.
But this works as far as I know only since version 1.5
Example from the scribus wiki
# only one short flag + scribus doesnt open a document (the script itself does it)
scribus -py somescript.py --python-arg v
Please have a look at the Scribus Documentation under
For Developers > Scripter API > Scripter Extensions
If you manage to write your functionality as "extension script", you can make Scribus execute it, on startup:
Scribus > File... > Preferences > Scripter > Enable Extension Scripts
and select your Script.
Now, if you run Scribus from the command line (not from the Python console), it should firstly run your script and do its magic.
Sorry, I did a longer search and could not find a way to send stuff from your Python console to your OS as if it were on the command line (I believe that would give you what you asked for). That would allow you to run your script (using Scribus) from your console.
Use the command line interface as such:
python foo.py
scribus -ns -f myfile
The Python script simply runs Save as PDF programmatically(Ctrl+Shift+P) every few seconds.
References
Scribus Command Line Reference
Scribus Help:Manual Configprefs
Open source desktop publishing with Scribus
PyAutoGUI - Cross-platform module to control the keyboard
Is there a way to run a Windows command line from within SPSS?
I'm working with a program that is not supported by SPSS BEGIN PROGRAM procedures and I would like to run a command line from my SPSS syntax (I'm not interested in the output and I don't need to import/export any SPSS data I just want to run a cmd line from within SPSS).
To take a simpler example using freeware, let's say I want to run my R script at the end of my SPSS syntax but this would only work with a version not supported by SPSS (e.g. at the moment SPSS 21 supports R 2.14, let's say I absolutely need to run it on R 2.15 installed on my Windows PC), is there a way to run
R CMD BATCH C:\Files\MyRcode.R
within the SPSS syntax?
This is equivalent to running a program (in this case R) in batch mode. The program I need to use is not R, it's just an example.
As far as I'm aware SPSS can't do this but maybe using python (through SPSS BEGIN PROGRAM PYTHON) one can run a command line by using Python?
Thanks
P.S. For Python users who may not have used SPSS before one should in theory be able to run any Python code from within SPSS by using
BEGIN PROGRAM PYTHON.
Run some Python code
END PROGRAM.
Yes, you can do it with Python code:
BEGIN PROGRAM PYTHON.
import subprocess
subprocess.call(['C:\\R\\R.exe', 'CMD', 'BATCH', 'C:\\Files\\MyRcode.R'])
END PROGRAM.
Or, directly, with this:
HOST COMMAND=['R CMD BATCH C:\Files\MyRcode.R'].
Alternatives:
Put it in a batch file then execute it, for example using os.system().
Execute the Python or Basic script through the SCRIPT command.