pandas的简单例子

标签(空格分隔): pandas


#-*- coding: utf-8 -*-
import pandas as pd

s = pd.Series([1,2,3], index=['a','b','c'])
d = pd.DataFrame([[1,2,3],[4,5,6]], columns = ['a','b','c'])
d2 = pd.DataFrame(s)

>>> d.head()
   a  b  c
0  1  2  3
1  4  5  6
>>> d.describe()
             a        b        c
count  2.00000  2.00000  2.00000
mean   2.50000  3.50000  4.50000
std    2.12132  2.12132  2.12132
min    1.00000  2.00000  3.00000
25%    1.75000  2.75000  3.75000
50%    2.50000  3.50000  4.50000
75%    3.25000  4.25000  5.25000
max    4.00000  5.00000  6.00000

Profeel
289 声望17 粉丝

Brilliant's everywhere.


引用和评论

0 条评论