I used pandas to read excel file and then received an ImportError shown below. code: Error: Then I installed xlrd on my computer using code shown below: But I still received the same issue. In output, it always returned this ImportError. It made me feel confused and frustrated, because I have installed xlrd o…
AttributeError: ‘NoneType’ object has no attribute ‘id’_
here is my code in the bot And this is my error in the terminal Please help me please, I can not solve this error myself, I use Python 39 Answer not the most optimal way, but i guess you can use this: It basically first checks if after is none, if its not then if after,channel is none? if
Why is Python re not splitting multiple instances of punctuation?
I am trying to split inputted text at spaces, and all special characters like punctuation, while keeping the delimiters. My re pattern works exactly the way I want except that it will not split multiple instances of the punctuation. Here is my re pattern wordsWithPunc = re.split(r'([^-w]+)’,words) If I …
Python, adding a different characteristic to each element of a list
i am currently working on a producion optimization tool. There are Jobs who needs to be produced on machines. I want to add a workspeed for the machines so they can finish the jobs in a different speed depending on the machine it is processed on. This is the class and list i am using for the machines: i want
Replace duplicate value with NaN using groupby
Dataset(MWE) I am trying to replace duplicates from columns {people_vaccinated,people_fully_vaccinated,people_vaccinated_per_hundred} with NaN while using groupby() on location. I tried some solution online, but couldn’t get them working for me, so instead used the below logic The above logic fails when…
PySpark write a function to count non zero values of given columns
I want to have a function that will take as input column names and grouping conditions and based on that for each column it will return the count of non zero values for each column. Something like this, but include non-zero condition as well. Answer You can use a list comprehension to generate the list of agg…
ValueError: check_hostname requires server_hostname
I was going to install pandas and epanettools on my computer using the code shown below with python 3.8.5 and I received one Error exception. Code: Actually, I could install epanettools on my old computer and I bought a new computer and I wanted to do the same thing on my new computer, but it didn’t wor…
Docker image not running on host 8050
I am trying to teach myself how to deploy a dash application on AWS. I have created a folder ‘DashboardImage’ on my mac that contains a Dockerfile, README.md, requirements.txt and an app folder that contains my python dash app ‘dashboard.py’. My Dockerfile looks like this: I go into th…
How can you change a particular letter to a number?
How can you change a particular letter to a number? programming Language -> Python How do you replace ‘K’ with an integer in a string value stored in a variable? K = 1000 Answer You can use regex –
im trying to learn scikit but stucked at the code which is about encoders require their input to be be uniformly string or number
I have been learning python form youtube videos. im new to python just a beginner. I saw this code on video so i tried it but getting the error which i dont known how to solve. This is the following code where im getting trouble. I didint wrote the enitre code as its to long. please help me fix my