numpy and statistics module - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: numpy and statistics module (/thread-5085.html) |
numpy and statistics module - baronmontesqieu - Sep-18-2017 hello. I am trying to get familiar with numpy and statstics module on python the latter is program i made to input any list and try to find the standard deviation of the list i am getting an error; please check on this. thank you very much. the latter is code import numpy import statistics rawstr = raw_input("type a 4-list of integers") rawstr1 = raw_input("type a 4-list of integers") rawstr2 = raw_input("type a 4-list of integers") ival = list(rawstr) ival1 = list(rawstr1) ival2 = list(rawstr2) arr = numpy.array([ival1,ival2,ival3]) statistics.stdev(arr)the latter is error thank you
RE: numpy and statistics module - Larz60+ - Sep-18-2017 you need to load package statstics RE: numpy and statistics module - snippsat - Sep-18-2017 statistics was new in version 3.4. So use Python 3.6, Win, Linux. There are several problem with that code. No need to use Numpy,if use statistics. Numpy has own statistics. Need to convert to integers. import statistics rawstr1 = input("type a 4-list of integers: ") rawstr2 = input("type a 4-list of integers: ") ival1 = [int(i) for i in list(rawstr1)] ival2 = [int(i) for i in list(rawstr2)] print(statistics.stdev(ival1 + ival2))
|