Skip to content

Tag: python

When is the usage of the Python Ellipsis to be preferred over ‘pass’?

I was just looking up the way to go for defining an abstract base class in Python, when I found the abc module (https://docs.python.org/3/library/abc.html). After a bit of reading I saw the following class: Wondering about the triple dots, which I found it is called the Ellipsis (https://docs.python.org/3/lib…

How to zip together lists of unequal length into a dictionary?

I have three lists. I’d like to make these lists into a dataframe in which each row is the author paired with each coauthor and the frequency of collaborations. Basically if I could zip these three lists together, with the list ‘author’ replicated over and over in each row, this would be gre…

matplotlib: draw a box on axes

I want to draw the box between y=75 and 90 (green and red lines on the chart), but nothing is shown up when I do ax.add_patch this is the image I get: So How do I fill out the area between red and green horizontal lines? Answer If you have a fixed area you want to fill and you want