This problem seems really stupid bu I can’t get my head around it. I have the following list: I have to produce a second list which have the same size as the previous one but the values that appear should be the amount of times that a value showed up in the array until that point. For example: So b[0]
Why it shows “NameError: name ‘histogram’ is not defined”?
I’m taking a course on Coursera and doing an assignment after watching a teaching video. I wanna know why it shows “NameError: name ‘histogram’ is not defined” after running my own code. Answer Add histogram library in your code. please add line in the starting of the code. I sho…
Python concat through a list of strings inside a dataframe
I have this df: I need to transform each value in attach list to a link: For example: Where each value is the key in link to download. I tried to use apply func but doesn’t worked: the following error is displayed: TypeError: can only concatenate str (not “list”) to str Answer Take a look at…
Django user registration form not showing properly
I am making a Django project where there are two types of users customer and restaurant. Both can register separately. Everything is running fine except that I cannot add CSS class to password field and there are warning showing around password field which I don’t how they are coming. Models.py Forms.py…
merge & write two jsonl (json lines) files into a new jsonl file in python3.6
Hello I have two jsonl files like so: one.jsonl second.jsonl And my goal is to write a new jsonl file (with encoding preserved) name merged_file.jsonl which will look like this: My approach is like this: However I am met with this error: TypeError: Object of type generator is not JSON serializable I will appr…
update dictionary base on time delta of value
I am trying to update a dictionary based on the time delta generated from its value. This is an example of the dictionary: I want to find out if the key value has a timestamp value that exceeds 24hr to delete it, so I have done this: but I get the following error: How can I manipulate the value of
Can’t open and write a file twice in a command in discord.py
I want to open a json file, to safe things in there and after a few seconds I want to delete that again. I asked already in dpy support. They said, I can’t open a file in write mode. But how can I open the file anyway? Or how can I get out of this write mode? I tried this:
unable to scrape status of product
I want to scrape price and status of website. I am able to scrape price but unable to scrape status. Couldn’t find in JSON as well. here is link: https://www.zoro.com/jonard-tools-diagonal-cutting-plier-8-l-jic-2488/i/G2736212/?recommended=true Answer You can use Json microformat embedded inside the pag…
Python finding numbers from a list that satisfy a specific condition [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about programming within the scope defined in the help center. Closed 2 years ago. Locked. There are disputes about this question’s content being resolved at this time. It …
How to suppress “coroutine was never awaited” warning?
All search results on “coroutine was never awaited” are for people who were either trying to fire-and-forget or actually did forget to await. This is not my case. I want to use a coroutine the same way I often use generators: I’m creating it here while I have all the variables handy, but I&#…