• Register

Recent questions tagged python-numpy-matplotlib-sytax

0 votes
1 answer 37 views
Problem: I have such Python code: import numpy as np import matplotlib.pyplot as plt def f(x): return np.int(x) x = np.arange(1, 15.1, 0.1) plt.plot(x, f(x)) plt.show() And such error: TypeError: only length-1 arrays can be converted to Python scalars How can I fix it?
asked Jan 10 Mashhoodch 10.8k points
1 vote
2 answers 275 views
Problem: I am getting the error “typeerror: unhashable type: 'slice'’ when I run the program below import numpy as np import matplotlib.pyplot as plt import pandas as pd dataset = pd.read_csv('50_Startups.csv') y=dataset.iloc[:, 4] X=dataset ... OneHotEncoder labelencoder_X = LabelEncoder() X[:, 3] = labelencoder_X.fit_transform(X[:, 3]) Your solution would be much appreciated. Thanks
asked Mar 7, 2020 Gavin 15.3k points
To see more, click for the full list of questions or popular tags.