Below is the data in which I am facing the issue: id electronics date 101 Mobile 2022-05-30 101 Laptop 2022-05-30 101 Laptop 2022-05-30 101 Laptop 2022-05-30 101 TV 2022-05-30 102 Mobile 2022-05-31 102 Laptop 2022-05-31 I need to find Cumulative sum of ID(Count) based on Month i.e. if the month end then it should start with 0. I have used
Tag: python-3.x
Error with a player turn ending loop in the Zombie Dice game
I’m trying to develop a code for the zombie dice game. My problem is when the first player replies that he doesn’t want to continue playing. The game ends and I can’t get the second player to play. Can someone help me? Does anyone know what I’m doing wrong? I’m new as a programmer. If anyone knows how to help
How to rename files chronologically without changing their order?
I made an application in Python (link for source code at the bottom) which renames files (in a directory) by sorting them (based on their extension) into one of these: Image, Video, Text, GIF, Audio and Unknown Extension. Basically, it loops through a directory, gets all the files in it, sorts them, for each file in the sorted list it
How to get items that are true for ANY() method in Python
Say: How to get the signs it found true in the iteration? Here’s a way Is there a better one liner way of doing it? (Without the for loop maybe) Answer With the few modifications to the any expression, you can get whether each of the signs is in the expression, which signs are in the expression, or just the
Retriving data from div and header classes using pyhton urllib.request and bs4
I am trying to create a python program which is capable of getting the objects title and its cost from ‘https://coinmarketcap.com/’ website. in this image i have my initial code. I keep getting an error that says: however, both the ‘priceHeading’ & ‘priceValue’ class have values of ‘bitcoin price’ and ‘29,000’ respectively. How do I get those values? here’s my
Function that returns proportion of values exceeding threshold with several variables
Consider the dataframe below, where there are several variables, each with the same number of values (in this case, 4). I would like to create a function that returns the proportion of values that are greater/less than the specified threshold values for several variables. The main goal is to create a function with the ability to enter however many variables,
beautifulsoup Case Insensitive?
I was reading: Is it possible for BeautifulSoup to work in a case-insensitive manner? But it’s not what I actually needed, I’m looking for all img tags in webpage, which include: IMG, Img etc… This code: Will only look for img tags case sensitive so how can I solve this problem without adding new line for every single possibility (and
Functions executing out of order?
I have a problem currently that makes no sense to me whatsoever. I am making a program that runs a script on a website using the selenium web driver. This is paired with a GUI I made with Tkinter. In short, I have a “Launch” button in the gui that is set to trigger this function: “script” is an external
Python Tkinter –AttributeError
Cannot seem to figure out the below Tkinter message. Usually doing a quick search will provide answers but this time I seem to miffed the search engines as to what might be causing the below error. Curious to know if I am missing a Python package or line 25 below is used in an older version of Python and it
Double assignment of same variable in one expression in Python – does it have any purpose?
I was going through delta lake documentation page. There is a line like this : In the last line, we see a double assignment of same variable (spark). Does this do something different compared to : In general, in python, is there a meaning to double assignment of same variable ? Answer Short answer: It’s meaningless. Aside from a few