Category "python"

Python multiplication table school exercise

I have a school exercise, but im struggling to understand how to do the multiplication table. Could someone please help me? So depending on the number and colu

How to solve Numpy installing error in windows 10, (Python 64 bit)?

I was installing numpy in python latest version 3.10.4 (64bit) after installation of python I did this below in cmd window. C:\Users\Administrator>mkdir pyve

"Module not Found Error : No module named albumentations"

I'm writing a code with albumentations function and it will give me this error ModuleNotFoundError: No module named 'albumentations' I also installed this pack

How to raise exceptions for when file is not specified and when the specified file does not exists?pyth

I a script I have: if __name__ == '__main__': try: file = sys.argv[1] with open (file, 'rb') as img_file: I run the script in terminal as: python3 s

Problems with logistic regression in Titanic dataset

I'm an aspiring data scientist. I stumbled across the titanic dataset. I tried to use logistic regression for the problem. However, I got stuck. Since I have tw

NameError: name ' ' is not defined, python

I have to create a class with two methods. This is the exercise: This is my attempted code: class Cats(): def __init__(self, name, breed, size):

Finding peak in a large data set with python

I want to know if there is a way to eliminate points that are not close to the peak. For example if I have a data set with 10 million points and the peak is aro

How to manually create a cron job to run a Django script?

I have been trying to run some code as a cron job using Django. There are a number of packages that help do this, but they do not seem to support the latest Dja

lines repeat in List python

I need your help with the next problem, i need that a python recieve an string "EEEEDDSGES" and the output would by the sum of charactes that repeat in line, E

python code not understand. Step by Step explanation of this code

a,b=1,2 a,b=b,a=a,b print(a,b) # 2 1 If someone could give me a line by line explanation of this code, help me plz

Return the string having repetitive substrings consecutively more than x times

I’d like to get the string having repetitive substrings consecutively more than x times. The substrings has more than y characters. For example, when x=4,

python - write to txt file. the problem: some file names are ok, some file names get error

for example: testdata.txt - is fine datatest.txt - fail it happens with a lot of file names, some names are just fine a lot of other names fail. examples on scr

del builtin not functioning on list

So I'm trying to create a program that deletes the cells in jupyter notebook that are code cells and delete go into the cells that have the word solution and re

How can I plot specific Excel data from two columns with conditions?

I have a huge spreadsheet of data that looks something like this: Date IDNumber Item 2021-05-10 1 Apple 2021-05-10 1 Orange 2021-05-10 2 Apple 2021-05-10 2 Gra

Is it possible to add a if condition inside tal:define?

I'm using python with Zope and I'm trying to create a variable with a if condition (if possible). I'm having a difficult time finding examples and resources onl

Catching SyntaxError from ast.literal_eval

I have the following code to evaluate some configuration values stored in a file: from ast import literal_eval for key, value in dict_read_from_file.items():

Matplotlib: Transformation of coordinates

I've been struggling with this issue for a while now. I simply want to transform my data in display world, perform some operations, and then translate back to t

Select subset of test cases from all possible combinations

Let's say I'm writing a lifespan prediction calculator that takes in ~40 inputs: sex = ['Male', 'Female'] smoking_status = [True, False] ... Eventually, there

Generate github personal access token (PAT) by command line or SDK

I am looking for the command or SDK, such as python, to generate new personal access token (PAT) in Github, but I didn't see any API for it. https://docs.github

Branching in Pyscipopt

Branching on t_x21 led to this error [scip_branch.c:1061] ERROR: cannot branch on variable <t_x21> with fixed domain [-0,0] So, my guess as to why this