String[] line=value.toString().split(",");
context.write(new Text(line[0]),new LongWritable(1));
long sum=0;
for (LongWritable value:values)[](
)
sum+=value.get();
context.write(key,new LongWritable(sum));
try {
String[] line = value.toString().split(",");
context.write(new Text(line[0]), new LongWritable(Long.parseLong(line[8])));
}catch (Exception e){
return;
}
long sum=0,count=0;
for (LongWritable value:values){
sum+=value.get();
count++;
}
context.write(key,new LongWritable(sum/count));
try {
String[] line = value.toString().split(",");
context.write(new Text(line[0]), new LongWritable(Long.parseLong(line[8])));
}catch (Exception e){
return;
}
long sum=0,count=0,max=0,min=400;
for (LongWritable value:values){
sum+=value.get();
count++;
max=Math.max(max,value.get());
if(min>value.get()){
min=Math.min(min,value.get());
}
}
context.write(key,new LongWritable(max));
context.write(key,new LongWritable(min));
def a1():
conn=pymysql.connect(
host="localhost",
user="root",
password="baidu123",
database="test"
)
cursor=conn.cursor()
cursor.execute("select * from exam")
data=cursor.fetchall()
exam_map={"year":[],"num":[]}
for row in data:
exam_map.get("year").append(row[0])
exam_map.get("num").append(row[1])
return jsonify(exam_map)
$.get("/a1").done(function (data){
myChart.setOption( {
xAxis: {
type: 'category',
data: data.year
},
yAxis: {
type: 'value'
},
series: [
{
data: data.num,
type: 'line'
}
]
})
})
![](https://profile-avatar.csdnimg.cn/default.jpg!4)
百度,java,不用回答
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- hwaaaaaa 2023-06-05 14:47关注
简洁明了,点赞
def a1(): conn=pymysql.connect( host="localhost", user="root", password="baidu123", database="test" ) cursor=conn.cursor() cursor.execute("select * from exam") data=cursor.fetchall() exam_map={"year":[],"num":[]} for row in data: exam_map.get("year").append(row[0]) exam_map.get("num").append(row[1]) return jsonify(exam_map)
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用
悬赏问题
- ¥15 在matlab中Application Compiler后的软件无法打开
- ¥15 想问一下STM32创建工程模板时遇到得问题
- ¥15 Fiddler抓包443
- ¥20 Qt Quick Android 项目报错及显示问题
- ¥15 而且都没有 OpenCVConfig.cmake文件我是不是需要安装opencv,如何解决?
- ¥15 oracleBIEE analytics
- ¥15 H.264选择性加密例程
- ¥50 windows的SFTP服务器如何能批量同步用户信息?
- ¥15 centos7.9升级python3.0的问题
- ¥15 安装CentOS6时卡住