Issue
I have been having some trouble with my code, about how to use the Kaggle database to find the popularity of data, and analyze it using Z-score algorithms. I have tried a lot, but can never seem to get my code to work. Here is the link to the data: https://docs.google.com/spreadsheets/d/1HIAzQta-dSfoovkdPeqKcBxANhaO9VR_TiNFwnUKFcU/edit?usp=sharing
And here is my code
for header in data.columns:
# average
sum = 0
n = 0
crab = 0
for i in data[header]:
sum += ele
n += 1
average = sum / n
# standard Deviation
for j in data[header]:
crab = np.std(crab)
for k in data[header]:
k = (k - average) / crab
print("k = ",k)
break
print(data.shape)
data.info()
data.hist(figsize=(14, 14))
%config InlineBackend.print_figure_kwargs={'facecolor' : "w"}
k is apparently = to - inf? and im really confused
Solution
You have written:
crab = 0
# ...
# ...
crab = np.std(crab)
# ...
# ...
k = (k - average) / crab # You are dividing by zero
Hence the infinty in the output
Answered By - Mouse
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.