获取内容资料
综合学习

爬取慕课网数据分析可视化

#将excel中的数据进行读取分析import openpyxlimport matplotlib.pyplot as pit #数据统计用的wk=openpyxl.load_workbook(‘销售数据.xlsx’)sheet=wk.active #获取活动表#获取最大行数和最大列数rows=sheet.max_rowcols=sheet.max_columnlst= #用于存储鞋子码数for i in range (2,rows+1):size=sheet.cell(i,3).valuelst.append(size)#以上已经将excel中的数据读取完毕#一下操作就你行统计不同码数的数量”’python中有一个数据结构叫做字典,使用鞋码做key,使用销售数量做value”’dic_size=for item in lst:dic_size[item]=0for item in lst:for size in dic_size:#遍历字典if item==size:dic_size[size]+=1breakfor item in dic_size:print(item,dic_size[item])#弄成百分比的形式lst_total=for item in dic_size:lst_total.append([item,dic_size[item],dic_size[item]/160*1.0])#接下来进行数据的可视化(进行画饼操作)labels=[item[0] +’码’for item in lst_total] #使用列表生成式,得到饼图的标签fraces=[item[2] for item in lst_total] #饼图中的数据源pit.rcParams[‘font.family’]=[‘SimHei’] #单独的表格乱码的处理方式pit.pie(x=fraces,labels=labels,autopct=’%1.1f%%’)#pit.show进行结果的图片的展示pit.savefig(‘图.jpg’)文件2。

为了定义常用的输出数据,Scrapy提供了Item类。Item对象是种简单的容器,保存了爬取到得数据。 其提供了 类似于词典(dictionary-like)的API以及用于声明可用字段的简单语法。

全选按钮取消全选按钮checkAll: function (flag) {this.checkAllFlag = flag;var _this = this;this.productList.forEach(function(item,index){if(typeof item.checked == “undefined”){// Vue.set(item,’checked’,true); // 全局注册_this.$set(item,’checked’,_this.checkAllFlag)}else{item.checked = _this.checkAllFlag}});this.calcTotalPrice;},4)实现商品金额的计算和删除功能;

computed: {totalMoney{this.allMoney = 0;this.lists.forEach( (item, key) => {if(typeof item.checked != “undefined” && item.checked==true){this.allMoney += item.productQuentity*item.productPrice}});return this.allMoney}}8、删除功能,点击删除按钮弹出遮罩层和对话框,对于动态切换显隐我们可以动态添加class也可以使用 v-if / v-show, 先在data里声明一个 iShow 来控制显隐,对于弹框我们绑定class这样写v-bind:class=”{‘md-show’:iShow}” ,对于遮罩层我们使用v-show这样写v-show=”iShow”,然后为删除按钮添加事件同时把删除的元素传递过去,在data里声明一个 deletId 用来记录删除的元素。

allItemClose == 1″ms-class-3=”haslimit:(item.inventory != 0 && (((item.inventory-item.sales) 1)。

chose(item){if(typeof item.checked == “undefined”){this.$set(item,’checked’,true);this.checkNum++}else{item.checked = !item.checked;if(item.checked){this.checkNum++}else{this.checkNum–}}this.lists.forEach( (element, index) => {if(element.checked && this.checkNum==this.lists.length){this.flag=true}else{this.flag = false}})if(this.flag){this.checkFlag = true}else{this.checkFlag = false}}6、给全选和取消全选按钮添加事件同时动态绑定class,这就很简单了直接循环遍历,把所有对象里checked属性设为 true,这里有一点需要注意的是当你全选或取消全选的时候一定要改变data里 checkNum 的值。

  • 口红

    {{item.productName}}
    赠送:

    {{item.productPrice}}
    有货

    {{item.productPrice*item.productQuantity}}

    移入我的收藏

///获取聚合后的标注NSArray *array = [_clusterManager getClusters:_clusterZoom];NSMutableArray *clusters = [NSMutableArray array];for (BMKCluster *item in array) {ClusterAnnotation *annotation = [[ClusterAnnotation alloc] init];annotation.coordinate = item.coordinate;annotation.size = item.size;annotation.title = [NSString stringWithFormat:@”我是%ld个”, item.size];[clusters addObject:annotation];}[_mapView removeAnnotations:_mapView.annotations];[_mapView addAnnotations:clusters];具体源码请在ClusterDemo中查看。

Similar Posts

发表评论

邮箱地址不会被公开。 必填项已用*标注