Pandas

来自Jack's Lab
(版本间的差异)
跳转到: 导航, 搜索
(Quick Start)
(Quick Start)
第13行: 第13行:
  
 
<source lang=python>
 
<source lang=python>
 +
$ python
 
Python 2.7.14 (default, Sep 23 2017, 22:06:14)  
 
Python 2.7.14 (default, Sep 23 2017, 22:06:14)  
[GCC 7.2.0] on linux2
 
Type "help", "copyright", "credits" or "license" for more information.
 
 
>>> import pandas as pd
 
>>> import pandas as pd
 
>>> d=pd.read_csv('test.csv', date_parser=lambda x: pd.to_datetime(float(x)), index_col='time')
 
>>> d=pd.read_csv('test.csv', date_parser=lambda x: pd.to_datetime(float(x)), index_col='time')

2018年5月15日 (二) 00:01的版本

Quick Start

test.csv:

name,time,Humi,Temp,dev_id,mac
temphumi,1526197529000000000,39.3,27.0,NOD78783243232,AABBCCDDEEFF
temphumi,1526202738000000000,39.3,26.9,NOD78783243232,AABBCCDDEEFF
temphumi,1526203290000000000,39.4,26.9,NOD78783243232,AABBCCDDEEFF
temphumi,1526203298000000000,39.4,26.9,NOD78783243232,AABBCCDDEEFF
temphumi,1526203303000000000,39.4,26.9,NOD78783243232,AABBCCDDEEFF
$ python
Python 2.7.14 (default, Sep 23 2017, 22:06:14) 
>>> import pandas as pd
>>> d=pd.read_csv('test.csv', date_parser=lambda x: pd.to_datetime(float(x)), index_col='time')

>>> d=d.drop(columns=['name'])
>>> d
                     Humi  Temp          dev_id           mac
time                                                         
2018-05-13 07:45:29  39.3  27.0  NOD78783243232  AABBCCDDEEFF
2018-05-13 09:12:18  39.3  26.9  NOD78783243232  AABBCCDDEEFF
2018-05-13 09:21:30  39.4  26.9  NOD78783243232  AABBCCDDEEFF
2018-05-13 09:21:38  39.4  26.9  NOD78783243232  AABBCCDDEEFF
2018-05-13 09:21:43  39.4  26.9  NOD78783243232  AABBCCDDEEFF





































个人工具
名字空间

变换
操作
导航
工具箱