I’m kind of new with python and there is something troubling me. I’m using pandas to read an excel file. All works well if I have the excel in the same directory as my .py file. What I want to know is what is the best way to get a file that is in a completely different path. I’ve searched
Tag: python
Exctract a value from a Json file(python)
Hi i’m not an expert and this problem kept me stuck for such a long time I hope that someone here can help me i would like to exctract the value “interestExpense” from the following json file: In this case the result should be -130000000 as a string but i m trying to find a way to create an …
Scipy ifft gives different results with seemingly identical input
Why would xcorr and xcorr2 be quite different here? M1 and M2 are numpy matrices. M1.shape[0] = M2.shape[0]. xcorr is what I would expect with this operation, but xcorr2 is something totally different and has imaginary numbers. xcorr does not have imaginary numbers. Answer Try giving xcorr and xcorr2 dtype=co…
How to start a QApplication from shell without blocking it?
I have a simple Qt5 Application which can be installed as a pip package. The package has an entry point so i can start the application via a command prompt. The called function looks like the following: And the MainWindow (minimal working example): The problem is that now the command prompt IS the main applic…
Export properties into .geojson file using geopandas
I have a script that creates a lot of Polygons using Shapely and then exports them as .geojson files. See toy example below However, I also have a list of numbers, each number is associated with one ploygon. Is there a way to export this with the GeoJSON file inside properties? For example, if I have a list: …
.py executable file not able to find imported functions included in the script when executed, why?
I have a .py script which import some functions from an another .py script, located in an another directory in the same folder. And some of those scripts import functions from some other .py scripts contained in the folder itself. I have created an executable file of my main.py file (which eventually uses fun…
How to get the value of a python script I run through ssh
I am using 2 raspberry pi and each of them has a camera connected. I am trying to run, from the first pi, a script to get the video feed of the second one. And for that, I would need the value my function returns through ssh. With a simple example : slaveScript.py masterScript.py I would like, for this exampl…
Using bind mount in Docker (Ubuntu 20.04)
I am really new to Linux and Docker, and i want to not rebuild docker image after every change of my code. I read, that you can use bind mount, but i can’t understand it’s syntax and usage. My Python files with Dockerfile is located at /etc/python-docker Answer You can mount your python files insi…
Is there a way to calculate cosine similarity between documents sets in Python?
I’m trying to calculate cosine similarity between documents sets. I’m using this code and it works very well, but the problem is that it sorts the results in descending order. Is there a way to get the results according to the comparison order of the inserted documents? Or is there another way to …
How To Assign Different Column Values To Different Variables In Python
I am trying to assign all the three unique groups from the group column in df to different variables (see my code) using Python. How do I incorporate this inside a for loop? Obviously var + i does not work. Answer From your comment it seems it is okay for all_vars to be a list so that all_vars[0] is the