forked from SixueLiu96/DescrStats
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDescrStat.py
More file actions
23 lines (18 loc) · 717 Bytes
/
Copy pathDescrStat.py
File metadata and controls
23 lines (18 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'''
------------------------------------------------------------------------
This script defines a function DescrStat() that gives descriptive
statistics for a comma delimited text file of one variable in which the
data are in one column and each observation is a row.
------------------------------------------------------------------------
'''
# Import packages
import numpy as np
def DescrStat(datafile):
data = np.loadtxt(datafile)
data_mean = data.mean()
data_std = data.std()
data_var = data.var()
print('Mean of the data is:', data_mean)
print('Standard deviation of the data is:', data_std)
print('Variance of the data is:', data_var)
return data_mean, data_std, data_var