questions

Exception has occurred: TypeError unsupported operand type(s) for *: 'NoneType' and 'float'

Exception has occurred: TypeError unsupported operand type(s) for *: 'NoneType' and 'float' Question: Code is correct, has an output, but gets the error message. import math class Prelim: def __init__(self): self.LA1 = int(input(‘Enter your grade in Lab Activity #1: ‘)) #100 self.LA2 = int(input(‘Enter your grade in Lab Activity #2: ‘)) #100 self.LA3 = int(input(‘Enter …

Total answers: 1

Can't convert all dates to timestamp in python

Can't convert all dates to timestamp in python Question: I’m trying to convert all the dates into timestamp from a url in json but I don’t know what I’m doing wrong, it gives me the following error: This is the code I’m using: from datetime import datetime from dateutil import relativedelta from dateutil import parser …

Total answers: 1

Python how to avoid a repeated dictionary key

Python how to avoid a repeated dictionary key Question: So, I was trying to make a function to distribute tokens from a dictionary that works as a data base to other blank dictionaries. I use the random.randint() to obtain random tokens out of the big dict and transferred them to the other dict until they …

Total answers: 1

Saving captured frames to separate folders

Saving captured frames to separate folders Question: Currently working on extracting frames from videos and have noticed that the images get overwritten. Would be nice to create a folder for each of the captured frames but I’m unsure how to do that. data_folder = r"C:UsersjagacDownloadsData" sub_folder_vid = "hmdb51_org" path2videos = os.path.join(data_folder, sub_folder_vid) for path, subdirs, …

Total answers: 1

I cannot pass a parameter inside a function to another function (Python)

I cannot pass a parameter inside a function to another function (Python) Question: I successfully defined a parameter and passed it to a function but when I return to main menu that parameter’s value is completely reset and I cannot use it anywhere. The value of the parameter stays only within the second function. Like, …

Total answers: 1

do i need to use exactly same attribute names to properties in custom preprocessing class which inherit scikit learn BaseEstimator?

do i need to use exactly same attribute names to properties in custom preprocessing class which inherit scikit learn BaseEstimator? Question: when writing custom classes inherit from BaseEstimator of the sklearn throwing AttributeError: object has no attribute . but that attribute is present and has values. class BaseNull(BaseEstimator, TransformerMixin): def __init__(self, variables: Union[str, list[str]], row_wise: …

Total answers: 1

How to find missing elements between two elements in a list in Python?

How to find missing elements between two elements in a list in Python? Question: I have a list as follows: [‘1’, ‘5’, ‘6’, ‘7’, ’10’] I want to find the missing element between two elements in the above list. For example, I want to get the missing elements between ‘1’ and ‘5’, i.e. ‘2’, ‘3’ …

Total answers: 5

How do I get rid of labels in django Form?

How do I get rid of labels in django Form? Question: I have dealt with only ModelForm previously, so it is my first time using Form. I’d like to get rid of labels from my form, however, how I get rid of labels in ModelForm does not seem to work with Form. Here is my …

Total answers: 1