valueerror

Pycharm output empty value

Pycharm output empty value Question: I have the following code: def area(x, y): return x*y w = int(input()) h = int(input()) print(area(w,h)) Every time I run it in Pycharm,VS works fine, it gave me this error: ValueError: invalid literal for int() with base 10: ” Also I tried switching int() to float() and this error …

Total answers: 1

ValueError: install DBtypes to use this function

ValueError: install DBtypes to use this function Question: I’m using BigQuery for the first time. client.list_rows(table, max_results = 5).to_dataframe(); Whenever I use to_dataframe() it raises this error: ValueError: Please install the ‘db-dtypes’ package to use this function. I found this similar problem (almost exactly the same), but I can’t understand how to implement their proposed …

Total answers: 3

TypeError: in python in custom input function, exception handling

TypeError: in python in custom input function, exception handling Question: While creating a guess_the_number game in python, I wanted to catch the exception if user enters an invalid number, i.e. ValueError when typecasting the entered string to integer, I created a takeInput() function. It works fine except for the part that when I raise an …

Total answers: 1

ValueError: time data '02/03/2022' does not match format '%d/%m/%y '

ValueError: time data '02/03/2022' does not match format '%d/%m/%y ' Question: How to return values only within a specific date range? I am new to python My code is: for report_date in REPORT_DATE_TYPES: if report_date in result: date = result[report_date].split(‘ ‘)[0] date = datetime.strptime(date, ‘%d/%m/%y ‘) but I am getting an error: raise ValueError("time data …

Total answers: 3

ValueError: Series.replace cannot use dict-value and non-None to_replace

ValueError: Series.replace cannot use dict-value and non-None to_replace Question: Code: h1=df[df["native-country"]!="?"] f1=h1.mode() df[‘native-country’] = df[‘native-country’].replace("?",df[‘native-country’].mode()) Error: ValueError: Series.replace cannot use dict-value and non-None to_replace I dont know why im getting this error hope someone could help me Asked By: Vishnu Venkat18 || Source Answers: My simplistic, recommended answer is to use: mode = df[df["native-country"]!="?"]["native-country"].mode()[0] df[‘native-country’] …

Total answers: 2

ValueError: A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 36, 36, 128), etc

ValueError: A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 36, 36, 128), etc Question: ValueError: A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: `[(None, 36, 36, 128), (None, 37, 37, 128)]` def conv2d_block(input_tensor, n_filters, kernel_size=3, batchnorm=True): # first …

Total answers: 1

Python: If/elif/else Statement Not Working as Expected?

Python: If/elif/else Statement Not Working as Expected? Question: So I have the user input an expression: Example: 1 + 1 d * 3 100 / j s * c To allow the user to mix numbers (int) and letters (str) I have the following if statement: user_input = input("Enter a math Equation: ") user_input = …

Total answers: 2

Is it possible to learn from and predict NaN-values with machine learning?

Is it possible to learn from and predict NaN-values with machine learning? Question: I’m trying to solve a regression problem with two output values. The output values act as two different thresholds for incoming booking values, to accept or reject the bookings. The two output values are manually set in the business case but this …

Total answers: 3

pd.Series.explode and ValueError: cannot reindex from a duplicate axis

pd.Series.explode and ValueError: cannot reindex from a duplicate axis Question: I consulted a lot of the posts on ValueError: cannot reindex from a duplicate axis ([What does `ValueError: cannot reindex from a duplicate axis` mean? and other related posts. I understand that the error can arise with duplicate row indices or column names, but I …

Total answers: 3