-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasicstats-pandas.tex
53 lines (32 loc) · 1.27 KB
/
basicstats-pandas.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
%=================================================================%
Stats
Pandas provides nifty methods to understand your data. I am highlighting the describe, correlation, covariance, and correlation methods that I use to quickly make sense of my data.
%=================================================================%
describe
The describe method provides quick stats on all suitable columns.
%=================================================================%
df.describe()
col1 col2
count 4.00000 5.000000
mean 2.65000 3.200000
std 4.96689 3.701351
min 0.10000 -1.000000
25% 0.17500 1.000000
50% 0.20000 2.000000
75% 2.67500 6.000000
max 10.10000 8.000000
%=================================================================%
covariance
The cov method provides the covariance between suitable columns.
df.cov()
col1 col2
col1 24.670000 12.483333
col2 12.483333 13.700000
%=================================================================%
correlation
The corr method provides the correlation between suitable columns.
df.corr()
col1 col2
col1 1.000000 0.760678
col2 0.760678 1.000000
%=================================================================%