Quantcast
Browsing all 13981 articles
Browse latest View live

Execute third function after the completion of first two functions run...

I have the following code:class RepeatTimer(Timer):""" Extending the threading.Timer class to execute functions at fixed intervals.""" def run(self): while not self.finished.wait(self.interval):...

View Article


How to make a Protocol that inherits methods and attributes from a concrete...

ScenarioI have a Foo protocol:class Foo(Protocol): fooname: str def do_fooey_things(self): passand a bunch of different types of concrete Foos:class PurpleFoo: fooname: str = "purple" def...

View Article


Image may be NSFW.
Clik here to view.

Pivoting/Transposing a dataframe [duplicate]

I have a pandas dataframe called new_df, and it has these columns:I want to I want to pivot this table so that the values in "Number" are turned into columns, while Name, Area, Buy_Date, Sell_Date, and...

View Article

Django Deploy to cPanel: Passengerfile.json' for reading: Permission denied...

I am trying to deploy my first Django application via my GoDaddy cPanel. I created my application in a virtual environment, but I'm stuck. I installed django then create wsgi file also. but now when I...

View Article

Wrong dependency installed with pip

I wonder if anyone could please help me with this issue:I have two python libraries lime and specsy, where the first library is a dependency of the second.At the time when I added lime to PyPi there...

View Article


ERROR: Could not build wheels for language-check, which is required to...

I am trying to install pycontractions via command prompt.pip install pycontractionsHowever, it seems to require language-check installation beforehand. I had tried to install language-check but it also...

View Article

how to invoke rag chain with two input?

I'm trying to invoke the rag chain with two input variable but I'm getting error.def get_data_from_llm(raw_text): # Initialize the LLM and create a chain llm = Together(...

View Article

Extract the string in one column when matches with another string list to...

I have a dataframe:A_1AB546 GTY 3BYU345 456 2AB546 HYT 1BYU345 BWER 34And, a search list of [546, 345]. If the string has any number of search list, then the whole string is extracted.I would like to...

View Article


ValueError: Unexpected numpy array shape `(2, 47)`

importsimport jsonimport avimport numpy as npimport structcontainer = av.open('./webcam/friday.mp3',format='mp3')for stream in container.streams:if stream.type == 'audio':format =...

View Article


how does this code work? all balanced permutations from codewars

I met this problem in codewars and I do not understand the solution from other users.This is the questionWrite a function which makes a list of strings representing all of the ways you can balance n...

View Article

Image may be NSFW.
Clik here to view.

How to overlay swarmplot and boxplot for groupdata

I created a grouped dataset a using pandas dataframe. I then set one column as hue, another as the x axis, and another as the y. I wanted to overlay a swarm plot and a boxplot. However, while the...

View Article

Add empty row with index in a Pandas dataframe

In all the examples and answers on here that I've seen, if there is the need to add an empty row ina Pandas dataframe, all use: ignore_index=TrueWhat should I do if i want to leave the current index,...

View Article

type error in api profile in django rest framework

typeError at /api/profile/init() got an unexpected keyword argument 'write only'Request Method: GETRequest URL: http://127.0.0.1:8000/api/profile/Django Version: 3.2.25Exception Type:...

View Article


How to fix circle's rotation?

A fragment of my python + pygame code: y_vector = math.cos(angle) * 15 x_vector = math.sin(angle) * 15 pointer_x = xpos + x_vector pointer_y = ypos + y_vector pygame.draw.circle(screen, "Red",...

View Article

I got `usecols` to select a subset and avoid this error problem

I load a .txt file into variable and reshape it, However, I got ValueError: the number of columns changed from 5 to 4 at row 205; use `usecols` to select a subset and avoid this error, How can I fix...

View Article


Async tasks not properly exited within a FastAPI websocket endpoint

I have a fastapi application that creates a websocket connection initiated by a react frontend. In it, I listen on a certain redis pubsub channel, and whenever a message is posted, I send that message...

View Article

Model.evaluate vs Model.predict: Keras , Transfer Learning : Why such...

I am using a pre trained resnet 50 model for image classification. After running the model for a few epochs here are the results I've gotten:Epoch 8/20 loss: 0.5705 - accuracy: 0.8785 - val_loss:...

View Article


Python dictionaries are different during processing and after

What I'm trying to do is split a list of dictionaries if a field has n values separated by commas, into a list of n dictionaries where all other fields are same but the field with multiple values now...

View Article

'Interface error: 2003' when connecting to database

I'm trying to use MySQL Connection/Python to connect to my database.Here's the output I'm getting:Traceback (most recent call last): File "bh2000.py", line 33, in <module> cnx =...

View Article

Indicator if a rejected_time within a group is within 5 minutes after a...

I'm trying to set up an indicator for when a new application causes the rejection of an old application.If any rejected_time within a personal_id occurs within 5 minutes after a creation_timestamp, it...

View Article
Browsing all 13981 articles
Browse latest View live