Question

Hi. It's a python and I got an error below comment import numpy as np arr=np.genfromtxt("/Volumes/Samsung...

Hi. It's a python and I got an error below comment

import numpy as np
arr=np.genfromtxt("/Volumes/Samsung SSD 860 EVO 500GB Media/Download/primenumbers.txt", dtype=int)
arr=arr.reshape(-1,1)
arr.shape
def find_cat(x):
if x<= 300:
return '<=300'
elif x <= 600:
return '<=600'
else:
return '<=1000'

arr2 = np.apply_along_axis(find_cat, axis=1, arr=arr)
arr2 = arr2.reshape(-1,1)
arr3 = np.hstack((arr, arr2))

arr_300 = np.array((col[0] for col in arr3 if col[i]=='<=300'), dtype=int)
arr_300
arr_300.shape
count_300=len(arr_300)
count_300
avg_300=round(np.mean(arr_300, 2)
avg_300

print("Number of items in category \ "<=300\"= (one), and average of numbers in this category =)

from print I don't know what is wrong please help me and fix the problems.

txt file is here -> https://drive.google.com/open?id=1F4c5svQG6Sv-JjqNjrq_FmpitVur4AmN

0 0
Add a comment Improve this question Transcribed image text
Answer #1

hii.. if you have any doubt please kindly comment

Add a comment
Know the answer?
Add Answer to:
Hi. It's a python and I got an error below comment import numpy as np arr=np.genfromtxt("/Volumes/Samsung...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hi it's my code for python I almost finished my project but only one thing left which is most con...

    Hi it's my code for python I almost finished my project but only one thing left which is most confusing part please help me I have to find most occurring ending character from a to z For instance, output should be like this I have to find a to z. Words starting with ‘a’ end mostly with ‘O’ Words starting with ‘b’ end mostly with ‘O’ ...... No words start with ‘O’(If there's no word in the character from a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT