当前位置: 首页 > news >正文

上海网站论坛建设微信多账号管理系统

上海网站论坛建设,微信多账号管理系统,西安网站建设地址,江门企业建站程序这篇文章原文出自kaggle#xff0c;文中给出了reduce_mem_usage方法可以用来自动缩减dataframe占用空间 这篇notebook展示了通过使用更合理的数据类型来减少dataframe的内存使用量 方法如下#xff1a; 迭代每一个column 检查column是否为数字型 检查column是否可以用inte…这篇文章原文出自kaggle文中给出了reduce_mem_usage方法可以用来自动缩减dataframe占用空间 这篇notebook展示了通过使用更合理的数据类型来减少dataframe的内存使用量 方法如下 迭代每一个column 检查column是否为数字型 检查column是否可以用integer表示 找出column下的最大值和最小值 选择适用于数据范围的最合适的数据类型 通过以上步骤处理后将一份测试数据从1.3GB减少到466MB import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)def reduce_mem_usage(props):start_mem_usg props.memory_usage().sum() / 1024**2 print(Memory usage of properties dataframe is :,start_mem_usg, MB)NAlist [] # Keeps track of columns that have missing values filled in. for col in props.columns:if props[col].dtype ! object: # Exclude strings# Print current column typeprint(******************************)print(Column: ,col)print(dtype before: ,props[col].dtype)# make variables for Int, max and minIsInt Falsemx props[col].max()mn props[col].min()# Integer does not support NA, therefore, NA needs to be filledif not np.isfinite(props[col]).all(): NAlist.append(col)props[col].fillna(mn-1,inplaceTrue) # test if column can be converted to an integerasint props[col].fillna(0).astype(np.int64)result (props[col] - asint)result result.sum()if result -0.01 and result 0.01:IsInt True# Make Integer/unsigned Integer datatypesif IsInt:if mn 0:if mx 255:props[col] props[col].astype(np.uint8)elif mx 65535:props[col] props[col].astype(np.uint16)elif mx 4294967295:props[col] props[col].astype(np.uint32)else:props[col] props[col].astype(np.uint64)else:if mn np.iinfo(np.int8).min and mx np.iinfo(np.int8).max:props[col] props[col].astype(np.int8)elif mn np.iinfo(np.int16).min and mx np.iinfo(np.int16).max:props[col] props[col].astype(np.int16)elif mn np.iinfo(np.int32).min and mx np.iinfo(np.int32).max:props[col] props[col].astype(np.int32)elif mn np.iinfo(np.int64).min and mx np.iinfo(np.int64).max:props[col] props[col].astype(np.int64) # Make float datatypes 32 bitelse:props[col] props[col].astype(np.float32)# Print new column typeprint(dtype after: ,props[col].dtype)print(******************************)# Print final resultprint(___MEMORY USAGE AFTER COMPLETION:___)mem_usg props.memory_usage().sum() / 1024**2 print(Memory usage is: ,mem_usg, MB)print(This is ,100*mem_usg/start_mem_usg,% of the initial size)return props, NAlist原文链接
http://www.zqtcl.cn/news/227708/

相关文章:

  • 如何制作多网页网站广州品牌seo推广
  • 域名怎么解析到网站什么是asp网站
  • 网站开发的税率做网站文案
  • 网站模板上传工具如何介绍自己设计的网页
  • 河北网站建设价格低国内做外单的网站有哪些
  • wordpress Apache升级优化营商环境的意义
  • 单页式网站系统wordpress自定义字段怎么用
  • 南宁网站设计要多少钱修改wordpress中的 功能 小工具
  • 南昌高端网站开发费用表域名价格排行
  • 怎么接网站开发外包中国观鸟记录的网站架构
  • 青海省住房和城乡建设厅的官方网站网站举报能不能查到举报人
  • dw做的网站如何上传云服务器网址生成app一键生成器
  • 山西建设厅网站密钥房山营销型网站建设
  • 网站空间多少钱哪里接单做网站
  • 建设部网站资质人员查询页面设计的对称方法包括哪几种形式
  • 滁州网站建设哪个好点iis发布网站无法访问
  • 网站项目建设的定义百度站长平台清退
  • ip开源网站FPGA可以做点什么建设网站的工作职责
  • 重庆微信网站开发公司建设网站技术标准
  • 网站开发浏览器银川市建设诚信平台网站
  • 找合伙人做红木家具网站建设银行员工学习网站
  • iis的默认网站没有自动启动长春小程序开发制作
  • 佛山住房和城乡建设部网站wordpress 英文主题
  • 零食网站策划书厦门建设网站的公司
  • 自己做的网站怎么发布到网上湖南做网站 干净磐石网络
  • steam网站代做设计公司招聘信息
  • 网站开发 书籍无广告自助建站
  • 青岛电子商务网站建设wordpress购物车会员
  • 大理建网站沉默是金吉他谱
  • 门户网站需要多少费用wordpress的中文插件安装