import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from scipy.stats import kurtosis,skew
from scipy import stats

函数定义

def resumetable(df):print(f"Dataset Shape: {df.shape}")summary = pd.DataFrame(df.dtypes,columns=['dtypes'])summary = summary.reset_index()summary['Name'] = summary['index']summary = summary[['Name','dtypes']]summary['Missing'] = df.isnull().sum().values    summary['Uniques'] = df.nunique().valuessummary['First Value'] = df.loc[0].valuessummary['Second Value'] = df.loc[1].valuessummary['Third Value'] = df.loc[2].valuesfor name in summary['Name'].value_counts().index:summary.loc[summary['Name'] == name, 'Entropy'] = round(stats.entropy(df[name].value_counts(normalize=True), base=2),2) return summarydef CalcOutliers(df_num): '''Leonardo Ferreira 20/10/2018Set a numerical value and it will calculate the upper, lower and total number of outliersIt will print a lot of statistics of the numerical feature that you set on input'''# calculating mean and std of the arraydata_mean, data_std = np.mean(df_num), np.std(df_num)# seting the cut line to both higher and lower values# You can change this valuecut = data_std * 3#Calculating the higher and lower cut valueslower, upper = data_mean - cut, data_mean + cut# creating an array of lower, higher and total outlier values outliers_lower = [x for x in df_num if x < lower]outliers_higher = [x for x in df_num if x > upper]outliers_total = [x for x in df_num if x < lower or x > upper]# array without outlier valuesoutliers_removed = [x for x in df_num if x > lower and x < upper]print('Identified lowest outliers: %d' % len(outliers_lower)) # printing total number of values in lower cut of outliersprint('Identified upper outliers: %d' % len(outliers_higher)) # printing total number of values in higher cut of outliersprint('Identified outliers: %d' % len(outliers_total)) # printing total number of values outliers of both sidesprint('Non-outlier observations: %d' % len(outliers_removed)) # printing total number of non outlier valuesprint("Total percentual of Outliers: ", round((len(outliers_total) / len(outliers_removed) )*100, 4)) # Percentual of outliers in pointsreturn

Kaggle酒推荐,winemag-data-130k-v2.csv相关推荐

  1. 性价比高的口粮酒推荐,聪明人都选这3款,口感醇厚,纯粮好喝

    对于爱喝酒的人来说,每天小酌一杯是惬意放松的享受,一杯纯粮美酒,既可以下饭,又可以为疲惫的生活带来一丝放松,微醺之后,满身舒爽. 不过爱喝酒的人,对酒也是很挑剔的,无论是不同香型.不同口感.不同档次, ...

  2. 华为大数据HCIP认证(HCIP-Big Data Developer V2.0) 考试大纲

    华为认证 HCIP-Big Data Developer V2.0 考试 考试内容 HCIP-Big Data Developer V2.0 大数据场景化解决方案总览.大数据场景化解决方案:离线批 处 ...

  3. mysql/data/mysql/general_log.CSV 超大清空步骤

    mysql/data/mysql/general_log.CSV 清空,具体操作如下: mysql>SET GLOBAL general_log = 'OFF'; mysql>RENAME ...

  4. kaggle上面的E-Commerce Data数据集练习(数据处理)

    熟练一下pandas和数据处理 项目地址 参考:Python数据清洗指南 Customer Segmentation with XGBoost (97.92%) 项目描述: 这是一个跨国数据集,包含2 ...

  5. Kaggle Lending Club Loan Data数据可视化分析与不良贷款预测

    文章目录 数据集介绍 数据可视化分析前的数据预处理 引入包和数据集 对特征缺失值的处理 保存处理好的数据集 数据可视化分析 申请贷款金额和实际贷款金额的数据分布 每年贷款笔数直方图与每年贷款总金额直方 ...

  6. 推荐BIG DATA Spark 的7本学习电子书籍(大牛专区)

    #目录 文章目录 Lean Apache Spark 2 Apache Spark 2.x Cookbook,第2版 Learning Spark Streaming Apache Spark 2.x ...

  7. 益商烧春十年酱酒推荐

    茅台镇的酱香酒,其实除了茅台以外,很多酒的质量也是顶级酒质的,比如这款益商烧春十年窖藏就是其中一款,这个酒的基酒经过十年的沉淀,酒体已经微黄,,这款酒的香味特别浓郁,细品微甜,舌尖层次感多,吞咽不辣喉 ...

  8. MySQL LOAD DATA INFILE 导入 CSV 格式数据

    主要介绍将 Neo4j 数据库中数据全部导入到 MySQL 数据库中,将 Neo4j 数据导出为 CSV 格式数据,然后再将 CSV 格式数据导入到 mysql 中. 前半部分,即 Neo4j 数据导 ...

  9. 转自知乎,亲民好酒推荐

    这里尽量为大家推荐一些符合大众喜好.业内公认好评."即使你不喜欢,你也会承认它不错"的酒款.而且介绍到的酒款还会有一个共同的特征,就是能让你方便的在网上买到. 大概会分为烈酒,利口 ...

  10. kaggle上面的E-Commerce Data数据集练习(可视化与部分特征工程)

    接上篇: https://editor.csdn.net/md/?articleId=103394900 集体换个列名 data = data.rename(index=str, columns={' ...

最新文章

  1. 2022-2028年中国数码相机行业投资分析及前景预测报告
  2. 偏依赖图(Partial Dependence Plots)是什么?排列重要性(Permutaion Importance)是什么?如何解读?有什么意义?
  3. 【转载】ftp获取文件
  4. ruby的module与Java的interface以及C++的friend
  5. 2021-09-25
  6. kotlin spring-webflux netty
  7. python升级matplotlib包_Python-matplotlib包
  8. LT8920无线通讯程序
  9. linux 手机 wlan信号桥,手机WLAN信号桥是什么?WLAN信号的作用和使用方法
  10. opencv SIFT角检测
  11. Python读写Excel简单案例及调试说明文档
  12. 惠普电脑u盘重装系统步骤_惠普电脑优盘装系统步骤
  13. iOS程序员自述,从月入10k到年薪百万,移动架构师如何养成的?
  14. GPS卫星星历与历书
  15. 15b万用表怎么测电容_手工改造丨把15B万用表隐藏的功能利用起来~
  16. 达人评测 i7 12700F和i5 12400F区别 i7 12700F和i5 12400F对比
  17. crx什么意思_CRX文件是什么
  18. 菜鸟入门:Java程序员学习之路
  19. lisp画垫圈_基于DCL和AutoLISP语言开发的垫圈标准件库
  20. 通用vue组件化登录页面

热门文章

  1. C# mysql导入文件报错:The used command is not allowed with this MySQL version
  2. ASP.NET 备忘
  3. 让Windows Server 2008+IIS 7+ASP.NET支持10万个同时请求
  4. create-react-app+antd+react-css-modules配置
  5. Greenrobot-EventBus源码学习(四)
  6. 运营商管道的精细化运营之路
  7. 笨办法学R编程(5)
  8. 让SQL2000的查询分析器能够直接编辑SQL2005的视图或存储过程
  9. 使用fastcgi_cache加速你的Nginx网站
  10. NeHe OpenGL第九课:移动图像