I’m using Jupyter Lab and I’m having trouble to add conda environment. The idea is to launch Jupyter Lab from my base environment, and then to be able to choose my other conda envs as kernels. I installed the package nb_conda_kernels which is supposed to do just that, but it’s not working as…
Tag: python
Python Pandas Loop through Dictionary Keys (which are tuples) and plot variables against each other
I have a correlation matrix (in the form of a DataFrame) from which I return a Series which is the top n correlated pairs of columns and the value of the correlation: See this for an example of what I mean. I take the resulting Series object and then cast as a dictionary like so: The resulting keys of this
Add toolbar button icon matplotlib
I want to add an icon to a custom button in a matplotlib figure toolbar. How can I do that? So far, I have the following code: For now, the only thing that it does is adding a new button (which do what I want) but the icon is only the tool’s name i.e.: “newtool”. How can I change this
Can pytest run tests within a test class?
I have a bunch of tests which I decided to put within a class, sample code is below: However, when I try to run the tests: pipenv run pytest -v -m integrationtest, they are not detected at all, where I got the following before moving them to a class: I now get this: Why does pytest not detect these tests?
FilterStore queue
I have a FilterStore and during my simulation there is a queue for the FilterStore.Get event at some times. Now I have two questions: Is there a way to see the actual elements in the queue, not just the object number? With FilterStore.get_queue I get this output: [FilterStoreGet() object at 0x221a47c6080, Fil…
Selenium – can’t find visible element until HTML is inspected?
I am currently using Selenium for a webcrawling application, and after several successful modules, the following situation left me stuck: I’m trying to locate an element of the class “menu” with the text “Reports” that is located inside a frame named “frame_applic”. P…
How to get video duration by youtube-dl in python?
I’m trying to get youtube video duration by using youtube-dl in python. here is the code, I cant find duration in dictMeta, how to get it? Answer just simple
Python: vending machine
The program offers items, has the user pay for items, gives the items, and updates the stock of each item. It seems to work more or less. I have 2 questions: I don’t know how to exit the vending machine program after the user answers “n” to “buy something else? (y/n): “. Is there…
python-win32com excel com model started generating errors
Over the last few days, I have been working on automating the generation of some pivot tables for a number of reports. Boiled down to the minimum, the following code was working without issue: This would pop-up an instance of excel and I could continue working in Python. But suddenly, today my scripts are fai…
How to implement a factory class?
I want to be able to create objects based on an enumeration class, and use a dictionary. Something like this: But I get the error: For some reason the dictionary can’t be created. Where am I going wrong here? Answer After looking at Bruce Eckel’s book I came up with this: This gets the user to sel…