Category "python"

InvalidCursorName : Django Admin error referencing wrong column in ForeignKey

I've setup a relationship using django's ForeignKey against 2 unmanaged tables like so: class Product(BaseModel): publish_name = models.CharField(unique=Tru

Enter names, display them as a list and print only the names that start with letter A from list

def make_list(number): names=[] for item in range (number): names.append(input("Enter your name with a capital letter.")) print(names)

I have a SettingWithCopyWarning searched for ways to solve it but still at a dead end

This is my code test['Predictions'] = true_prediction Error Try using .loc[row_indexer,col_indexer] = value instead

'BalancedBaggingClassifier' object has no attribute 'n_features_in_'

i am working on an imbalanced multi-class dataset, i am trying to pass it into a balancedBaggingClassifier but i keep getting the error below : code: import pa

GitHub workflows doesn't find a module

I'm trying to configure tests in the GitHub workflows for my FastAPI application. My alembic.ini -file is located in app folder. The alembic ´env.py´

Type error in this code for my ingredient multiplier

This is a picture of the error I'm getting when running the code: I can't figure out what it thinks is wrong. I assume it has something to do with the way I us

Tensorflow ImportError: invalid ELF header

python version:3.6.9 and 64-bit At the beginning, i can't download tensorflow ,i use pip install tensorflow,then it throw error ERROR: Could not find a version

Contents of a Tkinter table unable to be deleted

I'm currently trying to display a table in tkinter that refreshed every time the user switches frames. The way that I am doing this is through deleting all the

BitBlt | StretchBlt - Access is denied when the user is not logged in to Windows

I have a python program that uses simple Windows GDI functions like BitBlt and StretchBlt which runs at computer startup but it starts before the user has logge

Convert txt file, with variable categories, to dictionary and pandas df

I've converted a txt file that has a fixed number of variables, for every entry, to a dict and df. For example, if every entry in the txt file has a Date entry

Loss exploding while training CNN despite small learning rate

I have been working with synthetically produced data which consists of samples of the shape 4x1745 and 2 labels each of which further can have 120 classes. The

Selenium turning off on redirection problem

I have a problem with my selenium script. Basicly what is it supposed to do is click an element that redirects you to a completly different page (url and everyt

How exactly does discord.CommandPermission work?

I try to gray out some slash commands that only someone with the right permissions can use. I found out that you can gray them out for everyone if you set defau

I got formatting type error but I don't know why this happen

#35 name1 = "eric" age1 = 10 name2 = "jay" age2 = 13 print('name:',name1,'age:','%d','\n'+'name:',name2,'age:','%d' % (age1,age2)) I got an error which is this

Iterating through rows in a dataframe

I have a dataframe of 12 different teams with their own statistics. My objective is to repeat an entire series of steps for one team, and so on, until the last

If statement getting Skipped in a Function

I have defined a function that takes three entries, 2 numbers and an array. The Array is a 800 row 10 col array. The first column in the array has a number for

Scrapy symbol replace

I try to delete symsol ":" from dates and it doesn't work: oper_dates=response.css('.textonline__date::text').extract() for item in oper_dates: clean_oper

Django user authentication fails in selenium tests

I'm writing tests for my djangocms app, first time using selenium to replicate the browser/user. I'm trying to test the login page, user simply fills out the us

What is the syntax for writing txt file with multiple numpy arrays+scalars and how to read it in again?

I have 2 numpy arrays of same length lets call them A and B and 2 scalar values named C and D. I want to store these values into a single txt file. I thought of

What's the difference between `raw_input()` and `input()` in Python 3?

What is the difference between raw_input() and input() in Python 3?