山西汽车销量(hive)
1.创建数据库
create database db_cart;
2.使用数据库
use db_cart;
3.创建表
create table t_cart(
province STRING,
month INT,
city STRING,
county STRING,
year INT,
cartype STRING,
productor STRING,
brand STRING,
mold STRING,
owner STRING,
nature STRING,
number INT,
ftype STRING,
outv INT,
power DOUBLE,
fuel STRING,
length INT,
width INT,
height INT,
xlength INT,
xwidth INT,
xheight INT,
count INT,
base INT,
front INT,
norm STRING,
tnumber INT,
total INT,
curb INT,
hcurb INT,
passenger STRING,
zhcurb INT,
business STRING,
dtype STRING,
fmold STRING,
fbusiness STRING,
name STRING,
age INT,
sex STRING)
row format delimited
fields terminated by '\t'
location '/cart/log';
4.加载数据
load data local inpath '/root/cars.txt' into table t_cart;
需求:
1.1、通过统计车辆不同用途的数量分布
第一种情况:
select nature,sum(number)
from t_cart
group by nature
having nature is not null
and nature <> '';
第二种情况:
select '非营运' sum(if(nature='非营运',number,0)),
'营运' sum(if(nature<>'非营运',number,0))
from t_cart
where nature is not null and nature <> '';
1.2、统计山西省 2013 年每个月的汽车销售数量的比例
select a.year,a.month,a.counts/b.sums
from
(select year,month,sum(number) counts
from t_cart
group by year,month
having month is not null
and year is not null)a,
(select year,sum(number) sums
from t_cart
where year=2013
group by year)b;
1.3、统计山西省 2013 年各市、区县的汽车销售的分布
select year,city,county,sum(number)
from t_cart
where year=2013
group by city,county
having city is not null and city <> ''
and county is not null and county <> '';
2、用户数据市场分析:
2.1、统计买车的男女比例
性别:
女 0
男 1
select a.sex,a.counts/b.sums
from
(select sex,sum(number) counts
from t_cart
group by sex
having sex is not null and sex <> '') a,
(select sum(number) sums
from t_cart
where sex is not null and sex <> '')b;
2.2、统计的车的所有权、车辆类型和品牌的分布
brand STRING,品牌
mold STRING,车辆类型
owner STRING,所有权
select brand,mold,owner,sum(number)
from t_cart
group by brand,mold,owner
having brand is not null and brand <> ''
and mold is not null and mold <> ''
and owner is not null and owner <> '';
3、不同车型销售统计分析:
3.1、统计不同品牌的车在每个月的销售量分布(数量)
select month,brand,sum(number)
from t_cart
group by brand,month
having brand is not null and brand <> ''
and month is not null;
3.2、通过不同类型(品牌)车销售情况,来统计发动机型号和燃料种类(数量)
ftype STRING,发动机型号
fuel STRING,燃料种类
select brand,count(ftype),count(fuel)
from t_cart
group by brand,ftype,fuel
having brand is not null and brand <> ''
and ftype is not null and ftype <> ''
and fuel is not null and fuel <> '' ;
山西汽车销量(hive)的更多相关文章
- [转帖]Speed-BI数据分析案例:2016年8月汽车销量排行榜
[转帖]Speed-BI数据分析案例:2016年8月汽车销量排行榜 据中国汽车工业协会统计分析,2016年8月,乘用车市场表现较好,当月销量环比和同比均呈较快增长.1-8月,乘用车销量总体呈稳定增长, ...
- Speed-BI数据分析案例:2016年7月汽车销量排行榜
据中国汽车工业协会统计分析,2016年7月,汽车产销比上月均呈下降,同比呈较快增长.1-7月,汽车产销保持稳定增长,增幅比上半年继续提升. 7月,汽车生产195.96万辆,环比下降4.38%,同比增长 ...
- Speed-BI数据分析案例:2016年8月汽车销量排行榜
据中国汽车工业协会统计分析,2016年8月,乘用车市场表现较好,当月销量环比和同比均呈较快增长.1-8月,乘用车销量总体呈稳定增长,增幅比1-7月继续小幅提升. 8月,乘用车共销售179.5 ...
- Captain technology INC:全球新能源汽车格局突变
美国能源信息署EIA的统计数据显示,2020年上半年全美含纯电动和插电混动在内的新能源乘用车总销量仅为11.1万辆,同比缩水25%.虽然特斯拉在第三季度靠着13.93万辆的销量迎来了环比387%.同比 ...
- python爬虫——汽车之家数据
相信很多买车的朋友,首先会在网上查资料,对比车型价格等,首选就是"汽车之家",于是,今天我就给大家扒一扒汽车之家的数据: 一.汽车价格: 首先获取的数据是各款汽车名称.价格范围以及 ...
- Covid经济型自主汽车
Covid经济型自主汽车 Autonomous Vehicles in Covid Economy Covid经济已经对汽车行业产生了负面影响,更多的变化正在进行中,同时也带来了大量的不确定性.我们可 ...
- ElasticSearch聚合
前言 说完了ES的索引与检索,接着再介绍一个ES高级功能API – 聚合(Aggregations),聚合功能为ES注入了统计分析的血统,使用户在面对大数据提取统计指标时变得游刃有余.同样的工作,你在 ...
- 【 D3.js 入门系列 --- 4 】 如何使用scale(比例)
在上一节中使用了一个很重要的概念 — scale (这个不知道翻译成什么,暂且叫它比例).本节将重点介绍它的相关使用方法. 在介绍 scale 之前,先介绍两个经常和 scale 一起出现的函数,在上 ...
- 解读Gartner《2015年度新兴技术成熟度曲线报告》
详细见:http://www.360doc.com/content/16/0209/16/26186435_533443133.shtml 今年的报告评估了112个领域超过2000项新型技术的市场类型 ...
随机推荐
- 禁止input输入框历史记录
<input type="text" autocomplete="off" />
- 解决HTML乱码
转自:https://blog.csdn.net/yuxisanno139/article/details/80675426
- Java的volatile
1.同步 同synchronized相比(synchronized通常称为重量级锁),volatile更轻量级 如图,如果变量没有volatile关键字,那么A线程对该变量的改变存储在内存A,B变量不 ...
- java程序员究竟应该掌握点什么
JAVA程序设计(基础部分) JAVA程序设计(专题)
- 【转】Linux下的磁盘分区方法
转自:https://www.cnblogs.com/lbole/p/8904298.html 一.硬盘接口类型 硬盘的接口主要有IDE.SATA.SCSI .SAS和光纤通道等五种类型.其中IDE和 ...
- PAT Basic 1041 考试座位号 (15 分)
每个 PAT 考生在参加考试时都会被分配两个座位号,一个是试机座位,一个是考试座位.正常情况下,考生在入场时先得到试机座位号码,入座进入试机状态后,系统会显示该考生的考试座位号码,考试时考生需要换到考 ...
- 合肥学院ACM集训队第一届暑假友谊赛 B FYZ的求婚之旅 D 计算机科学家 F 智慧码 题解
比赛网址:https://ac.nowcoder.com/acm/contest/994#question B FYZ的求婚之旅 思路: 然后用快速幂即可. 细节见代码: #include <i ...
- 2019 ACM/ICPC 全国邀请赛(西安)J And And And (树DP+贡献计算)
Then n - 1n−1 lines follow. ii-th line contains two integers f_{a_i}(1 \le f_{a_i} < i)fai(1≤fa ...
- spring 管理bean
目录结构: Person.java package com.wss.entity; import com.wss.service.doHomeWork; public class Person { p ...
- 模型监控指标- 混淆矩阵、ROC曲线,AUC值,KS曲线以及KS值、PSI值,Lift图,Gain图,KT值,迁移矩阵
1. 混淆矩阵 确定截断点后,评价学习器性能 假设训练之初以及预测后,一个样本是正例还是反例是已经确定的,这个时候,样本应该有两个类别值,一个是真实的0/1,一个是预测的0/1 TP(实际为正预测为正 ...