每行代码各是什么意思
                 	
                        发表在Python图书答疑
                        2021-01-02                                                
                    		
                            《Python数据分析从入门到实践》第4章 序列的应用                            140页-0页                    	
                        
                        
                    
                    
                    	是否精华
                    	是
                    	否
                    
                    
                    
                            版块置顶:
                            是
                            否
                        
                    
                           import pandas as pd
import glob
filearray=[]
filelocation=glob.glob(r'./aa/*.xlsx') #指定目录下的所有Excel文件
#遍历指定目录
for filename in filelocation:
filearray.append(filename)
print(filename)
res=pd.read_excel(filearray[0]) #读取第一个Excel文件
#顺序读取Excel文件并进行合并
for i in range(1,len(filearray)):
A=pd.read_excel(filearray[i])
res=pd.concat([res,A],ignore_index=True,sort=False)
print(res.index)
#写入Excel文件,并保存
writer = pd.ExcelWriter('all.xlsx')
res.to_excel(writer,'sheet1')
writer.save()
        import glob
filearray=[]
filelocation=glob.glob(r'./aa/*.xlsx') #指定目录下的所有Excel文件
#遍历指定目录
for filename in filelocation:
filearray.append(filename)
print(filename)
res=pd.read_excel(filearray[0]) #读取第一个Excel文件
#顺序读取Excel文件并进行合并
for i in range(1,len(filearray)):
A=pd.read_excel(filearray[i])
res=pd.concat([res,A],ignore_index=True,sort=False)
print(res.index)
#写入Excel文件,并保存
writer = pd.ExcelWriter('all.xlsx')
res.to_excel(writer,'sheet1')
writer.save()
于2021-01-02 07:59:52编辑
        
        	
        
        
    
 
	
                                                 VIP会员
VIP会员 购物车
购物车


 私信
                         私信 
                     
					 
					 
					 发表新帖
发表新帖 立即签到
立即签到 
        		  
        		 
         		 关注
关注
                  回复
 回复 支持(
                	支持( 反对(
                    反对( 
                







 
                     
                     
					 
						 
						 
						 
						