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版本必须 ...
随机推荐
- algorithm++:一个整数称为是:【幸运数】,如果这个整数的各位数字的平方和为1或者反复计算各位数字的平方和为1 例如 19 是个幸运数
1):一个整数称为是:[幸运数],如果这个整数的各位数字的平方和为1或者反复计算各位数字的平方和为1 例如 19 是个幸运数 coding:java程序实现 import org.junit.Test ...
- Innodb的三大关健特性
今天看<MySql技术内幕InnoDB存储引擎>一书,学习了Mysql的三大关健特性,并记录如下: 插入缓冲 双写(double write) 自适应Hash索引 在记录这些特性之前,先对 ...
- D 楼房重建
时间限制 : - MS 空间限制 : - KB 评测说明 : 1s,256m 问题描述 小A的楼房外有一大片施工工地,工地上有N栋待建的楼房.每天,这片工地上的房子拆了又建.建了又拆.他经常无聊 ...
- Vertica的这些事(三)——Vertica中实现Oracle中的ws_concat功能
vertica中没有类似Oracle中的ws_concat函数功能,需要开发UDF,自己对C++不熟悉,所有只有想其他方法解决了. 上代码: SELECT node_state, MAX(DECODE ...
- Linux - ubuntu下Vim安装失败,报The following packages have unmet dependencies: vim : Depends: vim-common
错误命令行 root@ubuntu:/etc/apt# apt install vim Reading package lists... Done Building dependency tree R ...
- Centos6升级内核方法
docker需要内核在3.0以上,如果centos6上需要安装docker的话需要先将内核进行升级 工具/原料 Centos6.5_x64 方法/步骤 操作系统为centos6.5,内核为 ...
- Linux命令 dos2unix 的实际应用场景
问题描述:书接上文springboot之停止与启动服务的脚本,编写杀死服务脚本的时候,总是不行,Linux会提示你类似下面这样的信息: killed pid: : arguments must be ...
- shell编写一个判断脚本
shell编写一个判断脚本 4.1问题 本例要求在虚拟机server0上创建/roo ...
- go 反射包
一.什么是反射? 反射是用程序检查其所拥有的结构,尤其是类型的一种能力: 二.Printf Printf 的函数声明为: func Printf(format string, args ... int ...
- Linux 压缩备分篇(一 备份数据)
备份文件 dump dump: -S 仅列出待备份数据需要多少磁盘空间才能够备份完毕 -u 将 ...