Category "python"

Adding new column with first non Nan for each row closest to a chosen column from a dataset Python

Hello I want to create a new column from a given dataset (that I call here "df") with the first non-Nan for each row and closest from a given column For example

Google Colab: pip install and imports from a custom script

In MyDrive/colab a I have these files: 00-imports.py with content... !pip install boto3 classes.py with content... class Test def __init__(self): print(

Intra-cluster for custom k-means

I'm stuck trying to implement and plot in python the intra-cluster of each cluster in k-means to get best number of k. Which is represented using this formula

Exception ignored in: <function BaseMySQLSocket.__del__ at 0x000002B15E76E5E0>

I have this strange error in my code, it started to show just like that - no changes in the code. The same code is working with no problems when I run it from p

Using satpy, Blending multiple satellite image

I want blend multiple satellite images. but an error occured. I followed the example on the satpy document. here is code and netcdf file is here : https://drive

Flask-Login: Redirect to page after login

**The problem was in this code lgin enter image description here You only needed to delete 1 line (<form metod="POST" action="/singup") to make everything wo

Real time chat application with Django Channels

My real time chat application refuses to send message. no errors at all. I have tried tracing the errors by logging to the console at every stage passed and als

How to draw a continuous contour plot with discrete coordinate data (DataFrame form)?

The row data has 3 columns and cannot shape a uniform grid based on 'x'&'z', so I am not able to plot the contour as the existed question: Create Contour Pl

plotting error bar on x-axis on a timeseries python

I have data representing mean concentrations over 5 months, some means are over a 24 h period and some are weekly means. I want to plot everything as a scatterp

How can I get my loading circle GIF frames to display on a Tkinter Canvas?

I am having trouble getting a loading circle GIF to display on a Tkinter Canvas in my game's support window. My game is called Space Invaders Supreme, and it is

Get a list of all NFTs owned by a solana wallet - Python

Im trying to make a python discord bot which pulls all NFTs owned by a wallet which is input by a user. Going through the solana.py docs it only seems they supp

Merging 2 binary files and read them

I have two files that I want to merge in the same file, and afterwards read them. One is an image with almost all values equals, and hence is only 400 bytes siz

How to make bot run a slash command discord.py

I'm trying to send slash commands with a selfbot ran on repl.it but they are sent as a normal message and not detected as slash commands. I know discord selfbot

Broadcast message to multiple Multiprocessing processes

I have a Multiprocessing application with a bunch of processes, I want the control thread to broadcast a message to multiple processes. If I used a pipe pair fo

Binding keyboard.on_press_key inside a For Loop in Python

I'd like to set up on_press_key binds using Python's Keyboard module through a For loop that's iteration through dictionary items. However, the binds do not see

Why "for i in q" makes the result different from "for i in range(len(q))"?

I have code for calculating max depth using BFS, which works fine, but I couldn't figure out why it fails if I replaced for i in range(len(q)): with for i in q:

how to bmp bytes transfrom to bmpfile

I make a barcode by zint. If it successes it will be creat a bmp file. But I want to its bmpdata. Now I get its bmpdata,I don't konw to show it by pyqt5.Becsuse

Find max value that is multiple of 3 in an array

Recently, I've got a code test from ABC. Please take a look at this one and give me your idea. Find the max value of an array of N integers. E.g. [ 1, -6, 2, 0

How to drop columns and rows with missing values?

I've been trying to take a pandas.Dataframe and drop its rows and columns with missing values simultaneously. While trying to use dropna and applying on both ax

How to resolve the following error in discord.py: "TypeError __init__() missing 1 required keyword-only argument: 'intents'"

I'm using Heroku as my server host of my Discord.py bot, but i am having a problem. the problem is: Traceback (most recent call last): File "test.py", line