• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Python Request for help with basic statistics using NumPy

Please see the attachments. I do not understand how to insert the required numbers. Many thanks in advance for any wisdom you may proffer.
 

Attachments

  • Screenshot_20220617-101817.jpg
    Screenshot_20220617-101817.jpg
    578.6 KB · Views: 2
  • Screenshot_20220617-101811.jpg
    Screenshot_20220617-101811.jpg
    494 KB · Views: 2
Hiya, You need to copy and paste your code into the forums rather then screen shots. It makes it easier for us to help :D
Sorry, simong1993! Please find my code pasted below. I am certain I am failing to do a great deal that should be very obvious. Again, many thanks.

Python:
# np_baseball is available

# Import numpy
import numpy as np

# Print mean height (first column)
avg = np.mean(np_baseball[:,0])
print("Average: " + str(avg))

# Print median height. Replace 'None'
med = None
print("Median: " + str(med))

# Print out the standard deviation on height. Replace 'None'
stddev = None
print("Standard Deviation: " + str(stddev))

# Print out correlation between first and second column. Replace 'None'
corr = None
print("Correlation: " + str(corr))
 
Last edited by a moderator:
Sorry, simong1993! Please find my code pasted below. I am certain I am failing to do a great deal that should be very obvious. Again, many thanks.

Python:
# np_baseball is available

# Import numpy
import numpy as np

# Print mean height (first column)
avg = np.mean(np_baseball[:,0])
print("Average: " + str(avg))

# Print median height. Replace 'None'
med = None
print("Median: " + str(med))

# Print out the standard deviation on height. Replace 'None'
stddev = None
print("Standard Deviation: " + str(stddev))

# Print out correlation between first and second column. Replace 'None'
corr = None
print("Correlation: " + str(corr))
For anyone who is kind enough to take interest in my problems, I do not know how to replace 'None' with numerical input. I receive no syntax error but obtain no numerical value. If you deem the question worthy, please help me bridge the gap. Many thanks in advance.
 
Top