当前位置: 首页 > 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.pierceye.com/news/227708/

相关文章:

  • 打开网站乱码怎么做河南平台网站建设
  • 物流网站源代码安平县网站建设
  • 自助服务器网站建设修改wordpress的库名
  • 惠州做网站乐云seo网站建设如何插音乐
  • 自媒体图片素材网站东莞网站建设推广技巧
  • 新浪网站是什么程序做的六安网站关键词排名优化地址
  • 手机网站大全123456镇江手机网站建设
  • 企业网站模板下载哪家公司强服装设计就业前景如何
  • 婚纱网站源代码网站制作专业的公司
  • 公司经营范围 网站开发网络工程好就业吗
  • 企业网站建设与管理试题wordpress设置页面访问权限
  • 中国顺德手机网站设计安居客做网站
  • 网站运营的含义百度地图轨迹导航
  • 网站开发时创业中文网站模板
  • 男人最爱的做网站网站建设合作合同范文
  • 我和你99谁做的网站做润滑油网站图片
  • 基于wordpress门户网站wordpress可以自己写代码吗
  • 自己做发卡网站wordpress搬家出问题
  • 网站建设数据库搭建秦皇岛市属于哪个省
  • 网站建设怎样找客户辽宁网站定制企业
  • 建设工程项目管理网站上海it公司
  • 网站运营需要 做哪些工作做网站需要了解的知识
  • 旅游去过的地方可做标识网站百度一下网页入口
  • 做ps找图的网站有哪些法与家国建设征文网站
  • 途途外贸企业网站管理系统aspnet网站模板
  • 网站建设企业网站常用参数
  • 深圳市建设工程质量检测网站网站建设公司 待遇
  • 站长工具大全php做在线直播网站
  • 品牌建设网站公司排名3d模型代做网站
  • 保定网站建设模板联系方式网站设计时图片怎么做