Skip to content

Tag: python

numpy array –> sort descending unique values base count of values

I have a numpy array: I want the same unique array back, but sorted descending in the order of occurrences of the elements. In this example, 6 occurs 3 times, 1 occurs 2 times and all the other elements only occur 1 time, so the result should be: Does anyone know how this can be done? Thanks in advance! Answe…

Issue with Subprocess Popen Python

I searched on stack overflow but I did’nt find a correct answer. I use subprocess popen to call and run an entire python script and it works fine, like that : subprocess.Popen([‘python3’, ‘/home/pc/Dossier/Dossier2/Nom.py’], ) But in my system I want to modify a variable in the s…

Can not find library valkka

I try to use this library to control my ptz cameras https://elsampsa.github.io/valkka-examples/_build/html/index.html instead of https://github.com/FalkTannhaeuser/python-onvif-zeep. In tutorial page, https://elsampsa.github.io/valkka-examples/_build/html/onvif.html I see the next example: but I can’t f…

extract extreme values from xarray dataarray

I have a rather large dataset, and need to find in that dataset extreme values, including coordinates. The real dataset is much larger, but let’s take this one for testing: I want to find in this dataarray all values larger than 2. I found on here this solution: but even in this small example, this prod…

User Input to set dynamic variable Python

I made a simple random.choice code by myself. But there is a major problem with it. I can’t take user input to dynamically set variables. What I’m trying to achieve is taking a user input and setting that as zorluk_secimi and after that if it matches to a category it will pick a random word from t…