from tornado.web import  RequestHandler
from pymongo import MongoClient
import pandas,xlrd
from pandas import DataFrame,Series
import json
import os
import time
currentpath =os.getcwd()
class multiupload(RequestHandler):
def get(self):
self.render('multifilesupload.html')
def post(self):
if self.request.files:
sourcefile = self.request.files
for i in sourcefile.keys():
targetpath = currentpath+"\\temfile\\"+sourcefile[i][]['filename']
with open(targetpath,"wb") as writer:
writer.write(sourcefile[i][]['body'])
self.write(json.dumps({"status":"ok"}))
else:
self.write(json.dumps({"status": "motherfuck"}))
class qingxiniaodao(RequestHandler):
def get(self):
self.render('mongowithpanda.html')
def post(self):
if self.request.files:
filename = self.request.files['fileobj'][]['filename']
filename =currentpath+"\\temfile\\"+filename
with open(filename,"wb") as writer:
writer.write(self.request.files['fileobj'][]['body'])
mydataframe = pandas.read_excel(filename)
#print(mydataframe)
title =[]
rets=[]
superdict = {}
retlist =[]
print("这是表头:",mydataframe.columns)
for i in mydataframe.columns:
title.append(i)
#mydataframe.values----结果集ndarray类型
print("算出数据集的行,列数:", mydataframe.values.shape)
rowcount = mydataframe.values.shape[]#ndarray的行数,--元组
i=
print("打印数据集的值:", mydataframe.values)
print("打印数据集的某行某列:", mydataframe.values[][])
k=
for i in range(,rowcount):
for k in range(,len(title)):
superdict[title[k]]=mydataframe.values[i][k]
retlist.append(superdict)
superdict = {}
i+=
# for i in title:
# superdict.a
self.write(json.dumps({"rets":retlist}))
输出结果:
这是表头: Index(['articleflid', 'articlefl', 'articleflcn'], dtype='object')
算出数据集的行,列数: (, )
打印数据集的值: [[ 'fist' '拳法']
[ 'kick' '腿法']
[ 'knee' '膝击']
[ 'wrestling' '摔法']
[ 'fit' '体能']]
打印数据集的某行某列: 拳法

最新文章

  1. 剖析AngularJS作用域
  2. C# DataTable 和List之间相互转换的方法
  3. 【leetcode】Rotate Image
  4. apache配置域名指向
  5. read the python code and predict the results --- from <Learn Python The Hard Way>
  6. 设计webapp的新思路
  7. Linux_ERROR 1045 (28000): Access denied for user 'root'@'localhost'
  8. SpringBoot文档翻译系列——29.SQL数据源
  9. find the nth digit(二分查找)
  10. 智能合约语言 Solidity 教程系列2 - 地址类型介绍
  11. UE4笔记:利用Widget设计一个切换材质功能
  12. 2018.2.21 Python 初学习
  13. Docker容器镜像瘦身的三个小窍门(转)
  14. Heaps(Contest2080 - 湖南多校对抗赛(2015.05.10)(国防科大学校赛决赛-Semilive)+scu1616)
  15. (zhuan) Using convolutional neural nets to detect facial keypoints tutorial
  16. 06.linux文件目录操作命令
  17. python自学——文件修改
  18. zookeeper 官方文档——综述
  19. php格式化保留2位小数
  20. python版opencv:如何用笔记本摄像头拍照保存

热门文章

  1. 自定义 filter simple_tag inclusion_tag 总结
  2. U盘安装Ubuntu Server CD-ROM挂载失败
  3. DDOS常见攻击类型和防御措施
  4. 卸载pkg安装包
  5. [AGC040C] Neither AB nor BA
  6. rabbitmq五种消息模型整理
  7. Docker学习1
  8. CVE-2018-18955漏洞学习
  9. Codeforces 1178D. Prime Graph
  10. Java后端技术面试汇总(第一套)