Category "python"

Why is my Discord Bot in GitHub not working?

When I run main.py it's giving me this error. I was just trying to replicate a bot from GitHub and I didn't know it would be this difficult, here is the GitHub:

Efficient way to update values in a GeoDataFrame based on the result of DataFrame.within method

I have two large GeoDataFrame: One came from a shapefile where each polygons has a float value called 'asapp'. Second are the centroids of a fishnet grid with 3

remove rows in dataframe which are not all 1 or all 0

I need to retain rows in the dataframe which has all row values as 0 or all 1. a = np.repeat(0,10) b = np.repeat(1,10) ab = pd.DataFrame({'col1':a,'col2':b}).tr

Using python how to take input search string from one excel sheet column and search in other excel on a specific column?

For example, take input string _TXT from col A in file 1 and search in file 2 col X. If any row contains _TXT, then for that specific row compare col B value to

PyQt6/PySide6: QStackedLayout aligns the size of nested widgets

I created a QStacedLayout and nested 2 widgets in it. However, as I understand it, if one widget is larger than the other, then QStackedLayout seems to be tryin

Volume slider in Tkinter with PyDub

Usually with audio you would access volume with: sound.volume = 10 However with Pydub, the volume is accessed using: sound + 10 The problem with this as I canno

Detect when user register/Login on Context Proccessor Django

I have to do some checks all the time with the context proccessor.The value must be 'True' as soon as the user logs in.But when navigating the site after loggin

selecting an xarray dataset by coordinates instead of dimensions (or switching coordinates to dimensions)

I have a, xarray dataset that is ocean color of the Atlantic Ocean called olci_ds. This dataset has dimensions of rows and columns and coordinates of lat, lon a

Sort columns values based on floats inside a string, then concat

I'm working on a pretty messy DF. Looking like this, but with 30 columns: a b some text (other text) : 56.3% (text again: 40%) again text (not same text) : 33%

How to parse this custom log file in Python3

The log file is generated by a program written in C++. Here is the demo log: |Frame:0|NUMBER:0 |Frame:1|NUMBER:1|{INDEX:0|RECT:[11,24][31,43]} |Frame:2|NUMBER:2

Remove Key = NaN within loop for Specific Column

I created a dictionary from a dataframe using a loop. The key are ID's but some ID's are NaN from source. How can I drop rows in the loop where the ID column (w

How can I draw a circle next to each other with a text in center uisng opencv in python?

I'm trying to draw a concurrent circles of equal radius on top row of image with a text on center of circle. I'm able to draw a single circle on center of imag

RecursionError: maximum recursion depth exceeded in comparison : Recursive function

i dont understand why am getting this max depth error . iam trying to find index of number in array using bst recursive approach , below is my code # Binary Sea

Order of Layers in Folium

I am working on creating a map where I am using weather data, as well as overlaying images to show where things are. My problem is that the ImageOverlay raster

understanding try except python/django

I need your help with understanding try-except python/Django. so I have this function: def submit_dept_head_application(request, application_id): cv = request.F

How do I implement pyshacl inference in module?

How do I implement the examples in SHACL Advanced Features using pyshacl in Python Module so I can get the inferred result?

How do I create a DNS response packet

I have tried this, first is the dns request packet. The second packet is recognized also as a dns request packet. I want the second packet to be a dns response

Reading command output with Paramiko invoke_shell/send/recv never finishes

I am trying to use send/recv function in Paramiko. According to what I see, the line throws an exception of timeout Evaluating: self.shell.recv(1024) did not f

How to save my first dataframe value with Pandas?

I just don't get it. I'm trying to save two different value(to different position) to an excel file, but the first one gets overwritten everytime. Why? @classme

Get the rudder rotation angle of the robot's compass

there is an electronic compass with angles of 1-360 degrees (or 0-359, whatever) https://i.stack.imgur.com/Q7RmH.jpg there are variables Yaw - compass readings