import pandas as pd #此包在pandas基础上实现sql from pandasql import sqldf file_name=r'/Users/gaochengcheng/Desktop/center.xls' file_name3='/Users/gaochengcheng/Desktop/center_left3.xls' file_name4='/Users/gaochengcheng/Desktop/center_left4.xls' #读数据 df = pd.read_excel(file_name, sheet_name = "left3") # 打印表数据,如果数据太多,会略去中间部分 print(df) sql ='''select * from df ''' df2=sqldf(sql) print(df2) #写数据 df2.to_excel(file_name4,index=False,header=True)
标签:数据分析,Users,python,Desktop,df,file,sql,pandas From: https://www.cnblogs.com/wangbin2188/p/17765439.html