I have a dataframe with 50k+ rows. df.head(5) is below: I need to create one more column with a list of months spent between start and finish dates to use df.explode relying on this column and get for every ID with months_used > 1 new row with date of every month the work was in progress. My primitive way …
Is it possible to read information from an xlsx file without any libraries in python?
I am forced to ask this question My mentor has given me a task to extract data from files with pure python, there were some txt file which were easy but there is a file with xlsx extension and I can’t find any where if it is possible to extract the data from it with pure python (I have been
How to show all details of the stored post while also hiding the query set
While I was adding a search bar in my blog. I had a design error I keep on getting query sets. Also when I search for the name of the post I want it show the name, snippet, author and others.(Example below with code.) Also Everything bold are meant to be a link. What it shows: What I want: views.py:
How can I connect two portion of my graph? in python
Hi all I have a graph which is split in two portion, like I am showing in the photo, I would like to connect the two portion by adding a red edges like I am showing in the photo. Someone know a networkx function to do that? Answer If you do not have to calculate anything else (meaning the nodes
PyGObject: How to create hamburger menu programmatically
I would like to create a “primary menu” programmatically, which I believe is also called a “hamburger menu”. I have done several of these while working on web development side, but I have never done these using Python and GTK. This topic seems to be controversial and there are a lot of…
How to filter based on referencing values? django
My model My goal is to get values that greater or equal the max or less than or equal the min. But, how to reference the max or min value from inside MyCell.objects.filter Answer You can compare your MyCell.Value and MyColumn.max with F() expressions.
How to make a Python code that will determine the number of minutes to get to a destination from a specific source (based on dictionary values)?
How can I write a function that will return the estimated number of minutes it will take to reach a destination from the source based on the data stored in the route dictionary. The route is one-way only and any destination can be reached from any source. EDIT: The sources and destinations are names of actual…
Python Flask-Mysql KeyError: ‘MYSQL_HOST’
I am building a python flask-Mysql app. I am building it using AWS cloud9. But When I run the code I am geting MYSQL_HOST key error. I am attaching code below. Is it because of the installation fault or code error.?` ` Answer You are calling application = Flask(__name__) twice. So second time you are overwrit…
FFmpeg export codec not supported by Samsung
I am using FFmpeg to render videos (concatenating image files with audio and then applying speed and volume filters) to export videos to upload to TikTok. As a result, I must first move the videos to my phone. I do not understand why my phone (S20) will happily play one of the videos (codec information pictur…
a simple way to produces classes with global state
Suppose I have a class, defined, for example, thus: Now, I want to create a class which is identical to testclass except I don’t want testclass’ state cl, but rather its own individual state. Experiment shows that inheriting from testclass inherits cl, so that does not work. Any words of wisdom ap…