valueerror

x and y must have same first dimension, but have shapes (9,) and (4,)

x and y must have same first dimension, but have shapes (9,) and (4,) Question: y_pred = fig.predict(x.reshape(1, -1)).reshape(-1) colors_dark = ["#1F1FIF", "#313131", "#636363", "#AEAEAE", "#DADADA"] colors_red = ["#331313", "#582626", "#9E1717", "#D35151", "#E9B4B4"] colors_green=[ "# 01411C", "#4B6F44", "#4F7942", "#74C365", "#D0F0C0"] filterwarnings("ignore") epochs =[ i for i in range(9)] fig, ax = plt.subplots(1, 2,figsize=(14,7)) train_acc1 = …

Total answers: 1

How to Inverse Transform a Predicted Output of a loaded pickle XGBoost model?

How to Inverse Transform a Predicted Output of a loaded pickle XGBoost model? Question: I am trying to run a program that could produce a predicted output using a loaded model (pickle file). The saved model (XGBoost) was trained to have its dataset to undergo transformation via StandardScaler before fitting it, and the predicted value …

Total answers: 2

ValueError: Length of values (1) does not match length of index (11123)

ValueError: Length of values (1) does not match length of index (11123) Question: I’m trying to create a new column on a dataset (csv file) that combines contents of pre-existing columns . import numpy as np import pandas as pd df = pd.read_csv(‘books.csv’, encoding=’unicode_escape’, error_bad_lines=False) #List of columns to keep columns =[‘title’, ‘authors’, ‘publisher’] #Function …

Total answers: 2

How can I print a day and a time using Python strftime?

How can I print a day and a time using Python strftime? Question: how can I print a day and a time using Python strftime? My code is below, but any time I run it, I get "ValueError: time data ‘1 day, 2:45:00’ does not match format ‘%H:%M:%S’" . I want the output to be …

Total answers: 1

i'm having trouble with ValueErrors in python

i'm having trouble with ValueErrors in python Question: I’m trying to create a class "Hippocrates" with a function inside that lets me create a dictionary from a given text document (the content of the document is not important to my issue). When I try to return a value from the dictionary and the key does …

Total answers: 3

ddeint – problem with reproducing examples provided in pypi

ddeint – problem with reproducing examples provided in pypi Question: I wanted to use the ddeint in my project. I copied the two examples provided on https://pypi.org/project/ddeint/ and only the second one works. When I’m running the first one: from pylab import cos, linspace, subplots from ddeint import ddeint def model(Y, t): return -Y(t – …

Total answers: 1

Rename a column if there is duplicate based on value in another column

Rename a column if there is duplicate based on value in another column Question: I have a dataframe like the following: df = pd.DataFrame({"Col1": ["AA", "AB", "AA", "CC", "FF"], "Col2": [18, 23, 13, 33, 48], "Col3": [17, 27, 22, 37, 52]}) My goal is if there are duplicated values in Col1, I would then sort …

Total answers: 2