Category "python"

How do I implement rank function for nearest values for a column in dataframe?

df.head(): run_time match_datetime country league home_team away_team 0 2021-08-07

docker discord.py ffmpeg.exe was not found

My code works on windows fine I'm just stumped on how to migrate it to my docker server for stability reasons and my old vm shit the bed. bellow is my main play

'bytes' object has no attribute 'condition'

I am trying to stream my Rpi (zero) camera (v2.0) to HTML using cv2.VideoCapture. However, I am facing a lot of errors and I'm currently stuck on this one as th

How can I get a variable valued current working directory (pwd) in powershell profile

I was trying to use anaconda as my Python virtual environment, and my virtual environment is stored in project directory. Manually, I need to use following comm

Why are orders in my trading algo not working? (QuantConnect algo)

I'm currently learning and trying to build my first algo which is a variation of an opening range break on the SPY. Would anyone know why my orders aren't worki

Which is the best way to represent my data

I have a following data structure: Page0 Key0 Text Color Name Key1 Text Color Name Page1 Key0

Proper automatic logarithmic axes when plot range less than a factor 10 (Matplotlib)

When the data range of logarithmic plots does not include a full factor of 10, the current (v3.5) Matplotlib code does not automatically produce publication-qua

What Python packages am I missing?

I'm trying to get my local Windows 10 PC up and running with my Django application. I'm a novice at Python and Django. My app was written by another developer w

python remoteconfig unable to parse file from Gitlab

I am trying to get remoteconfig working, following this guide: https://pypi.org/project/remoteconfig/ As a control, I have this code that works: config.read('./

Altering an immutable object?

def add_alpha(tuple_in): list_out = [] for t in tuple_in: t.append(10) a = ([1,1], [2,2], [3,3]) b = a print(id(a), id(b)) add_alpha(a)

How to create a curved line vector plot of a triangle in Python?

Question Suppose one has 3 random coordinates with 3 random functions that describe the continuous lines between them*, how would one create a vector plot in Py

How to check if dictionary keys match dictionary values in order

I'm trying to see if each key/value pair of a dictionary match, with the resulting output being True or False. I thought the below code would return True becaus

Python and spreadsheet: given the user input, expand the list of results using regex

I'm working with Python on a movie database on google sheets. I want to build a query searching a list of names and surnames on three columns. I ask the users t

Python flatten rows of 2D list

Currently working on a program that requires the flattening of columns, rows, and diagonals of a 2D list. I have written the following code that flattens the co

Generate Network Graph in Python from nested dictionary

I have an input dictionary like: d={'node1':{'node1_1':1.2,'node1_2':1.3,'node1_3':1.2},'node2': {'node2_1':1.3,'node2_2':1.3,'node2_3':1.4}} In th

How to add menu in python from a loop

for user in users: self.user_menu.add_command(label=user[0], command=lambda: self.userChange(user[0])) in the label user[0] works fine but

JSON link from google developer tools not working in Python (or in browser)

I am trying to extract the data in the table at https://www.ecoregistry.io/emit-certifications/ra/10 Using the google developer tools>network tab, I am able

Abstract class with multiple inheritance error: Can't instantiate abstract class ... with abstract method

I'm trying to get the following to work: from abc import ABC, abstractmethod class Abc1(ABC): def __init__(self, example_variable_1: int) -> None:

Disappearing handlers of logger in Python

I'm having trouble with using logging for multiprocessing Processes. As I understand all processes are separate ones so each process have their own logger. What

Django Authentication method is not working

I am trying to use the default Django from django.contrib.auth authenticate() method to authenticate if the user exists. I am doing this right after the user re