Python之numpy,pandas实践
Jupyter Notebook(此前被称为 IPython notebook)是一个交互式笔记本,支持运行 40 多种编程语言。
1.读取studentscores.csv数据集中scores的数据(已保存为CSV格式)并对其进行排序、去重,并求出和、累积和、均值、标准差、 方差、最小值 最大值。
导入
import numpy as np
import pandas as pd
读取resd_csv():https://www.jianshu.com/p/ebb64a159104
studentscores=pd.read_csv('studentscores.csv')
scores=studentscores['Scores']
print(scores)
排序 sort_values()
scores_1=scores.sort_values()
print(scores_1)
去重 https://www.cnblogs.com/wenqiangit/p/11252859.html
scores_2=scores_1.drop_duplicates()
print(scores_2)
求和sum()
scores_3=scores.sum()
print(scores_3)
累计和comsum():https://blog.csdn.net/qq_22238533/article/details/72900634
scores_4=scores.cumsum()
print(scores_4)
均值mean()
scores_5=scores.mean()
print(scores_5)
标准差std()
scores_6=scores.std()
print(scores_6)
方差 var(): https://blog.csdn.net/Guo_ya_nan/article/details/79936246
scores_7=scores.var()
print(scores_7)
最大值 max() 最大值位置 argmax()
scores_8=scores.max()
maxindex=scores.argmax()
print(scores_8)
print(maxindex)
最小值 min() 最小值位置 argmin()
scores_9=scores.min()
minindex=scores.argmin()
print(scores_9)
print(minindex)
Python之numpy,pandas实践的更多相关文章
- 【python】numpy pandas 特性(随时更新)
[value map] 用df.replace(dict)可以解决.但是如果dict太大,会非常非常慢. [array相加的维度规律][广播] (2,3) 能和 (3,) 相加,不能和(2,)相加 ( ...
- Python安装numpy,pandas慢,超时报错,下载不了的解决方法
由于python的默认源是国外的,所以下载的时候会很慢,甚至会出现超时下载失败,提供两个解决方法 1.设置pip的超时限制 打开cmd 输入pip --default-timeout=100 inst ...
- 统计学(检验、分布)的 python(numpy/pandas/scipy) 实现
scipy 中统计相关的 api:https://docs.scipy.org/doc/scipy/reference/stats.html https://zhuanlan.zhihu.com/p/ ...
- 有关python numpy pandas scipy 等 能在YARN集群上 运行PySpark
有关这个问题,似乎这个在某些时候,用python写好,且spark没有响应的算法支持, 能否能在YARN集群上 运行PySpark方式, 将python分析程序提交上去? Spark Applicat ...
- Python: NumPy, Pandas学习资料
NumPy 学习资料 书籍 NumPy Cookbook_[Idris2012] NumPy Beginner's Guide,3rd_[Idris2015] Python数据分析基础教程:NumPy ...
- 第一章:AI人工智能 の 数据预处理编程实战 Numpy, Pandas, Matplotlib, Scikit-Learn
本课主题 数据中 Independent 变量和 Dependent 变量 Python 数据预处理的三大神器:Numpy.Pandas.Matplotlib Scikit-Learn 的机器学习实战 ...
- Python 的 pandas 实践
Python 的 pandas 实践: # !/usr/bin/env python # encoding: utf-8 __author__ = 'Administrator' import pan ...
- Python之NumPy实践之数组和矢量计算
Python之NumPy实践之数组和矢量计算 1. NumPy(Numerical Python)是高性能科学技术和数据分析的基础包. 2. NumPy的ndarray:一种对位数组对象.NumPy最 ...
- python安装numpy和pandas
最近要对一系列数据做同比比较,需要用到numpy和pandas来计算,不过使用python安装numpy和pandas因为linux环境没有外网遇到了很多问题就记下来了.首要条件,python版本必须 ...
随机推荐
- Selenium系列(十五) - Web UI 自动化基础实战(2)
如果你还想从头学起Selenium,可以看看这个系列的文章哦! https://www.cnblogs.com/poloyy/category/1680176.html 其次,如果你不懂前端基础知识, ...
- [noip2016]愤怒的小鸟<状压dp+暴搜>
题目链接:https://vijos.org/p/2008 现在回过头去看去年的考试题,发现都不是太难,至少每道题都有头绪了... 这道题的数据范围是18,这么小,直接暴力呗,跑个暴搜就完了,时间也就 ...
- Hadoop调试记录(1)
错误 ERROR: Can't get master address from ZooKeeper; znode data == null 解决 关闭hadoop,发现stop-all.sh后几个进程 ...
- yum-程序包管理器前端工具
一.要想使用yum先要指定yum源 /etc/yum.com /etc/yum.repos.d/*repo 一.yum的使用 yum [option] command 包名 option -y: c ...
- 【cs224w】Lecture 1 & 2 - 图的性质 及 随机图
目录 Lecture 1: Introduction Lecture 2: Properties and Random Graph Degree Distribution Path Length Cl ...
- U - Inviting Friends HDU - 3244( LIS 最长升序子序列——变形 )
序列变换 Problem Description 我们有一个数列A1,A2-An,你现在要求修改数量最少的元素,使得这个数列严格递增.其中无论是修改前还是修改后,每个元素都必须是整数. 请输出最少需要 ...
- 逍遥云天 H5外部浏览器直接调起微信——通过url协议 weixin:// 判断是否安装微信及启动微信
h5分享到微信,h5使用微信支付这些功能,都需要先判断是否安装微信客户端,如果已安装就启动微信,如果没有安装微信,就提示用户前去安装. 我们可以通过访问微信提供的URL协议(weixin://)来实现 ...
- RHCS概述
RHCS概述 创建RHCS集群环境 创建高可用Apache服务 1 创建RHCS集群环境 1.1 问题 准备四台KVM虚拟机,其三台作为集群节点,一台安装luci并配置iSCSI存储服务,实现如下功能 ...
- Pytest系列(16)- 分布式测试插件之pytest-xdist的详细使用
如果你还想从头学起Pytest,可以看看这个系列的文章哦! https://www.cnblogs.com/poloyy/category/1690628.html 前言 平常我们功能测试用例非常多时 ...
- matplotlib Transform
2020-04-09 15:09:02 -- Edit by yangray Transform 类是TransformNode的子类,它是所有执行变换的TransformNode的实例的基类.所有非 ...