1. 程式人生 > >usecols選取指定列rename修改列名round指定有效位數

usecols選取指定列rename修改列名round指定有效位數

"""
Created on Tue May  9 20:35:45 2017


usecols選取指定列
rename 修改列名
round 指定有效位數




@author: PC
"""


import pandas as pd
data=pd.read_csv(r"D:\datasource\taxi_gps\TaxiRes_2015-05-18.csv",header=None,usecols=[1,2,3,6,7,8])
data=data.rename(columns={1:"start_time",2:"start_lon",3:"start_lat",6:"end_time",7:"end_lon",8:"end_lat"})
data=data.round({'start_lon': 6, 'start_lat': 6, 'end_lon': 6,'end_lat': 6})
data.to_csv(r"D:\datasource\taxi_gps\TaxiGPS_20150518.csv")