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版本必须 ...
随机推荐
- Django-on_delete
一.外键的删除 关于on_delete的总结 1.常见的使用方式(设置为null) class BookModel(models.Model): """ 书籍表 &quo ...
- web存储cookie会出现两个相同键值问题
我使用js存储cookie,定义key值是menu,存储过程中出现了相同的menu键值而且有的时候有一个还是null,折腾了三四个小时不知道啥问题: 早上到公司后想着换换键值,就把键值换成了selec ...
- Q - Marriage Match IV (非重复最短路 + Spfa + 网络最大流Isap)
Q - Marriage Match IV Do not sincere non-interference. Like that show, now starvae also take part in ...
- cxk不会二进制 (贪心)
cxk不会二进制 Description 最近cxk迷上了二进制,他很菜,有道简单的题不会做,挂在这里求大佬做一下: 以二进制形式给出两个数字:x,y.令s = x + y * 2 ^ k.输出能使 ...
- python中的列表和元组都有哪些区别
列表(list)和元组(tuple)的一些基础 list和tuple都是一个可以放置任意数据类型的有序集合,都是既可以存放数字.字符串.对象等 list和tuple都支持负索引 In [8]: num ...
- echarts图表x,y轴的设置
https://www.cnblogs.com/cjh-strive/p/11065005.html xAxis属性代表echarts图表的x轴设置代码如下 xAxis : [ { type : 'c ...
- js实现 多级联动
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8&quo ...
- 部署mysql主从同步
mysql-day06 部署mysql主从同步 案例拓扑 • 一主.一从 – 单向复制时,建议将 ...
- Vulnhub homeless靶机渗透
信息搜集 nmap -sP 192.168.146.6 nmap -A -Pn 192.168.146.151 直接访问web服务. 大概浏览一下没发现什么,直接扫描下目录把dirb+bp. BP具体 ...
- 关于Linux目录的配置
关于Linux目录的配置说明 大家都知道Linux一切皆文件,但是Linux的文件有那么多,目录也不少.他们都是干什么用的呢,有没有什么规律呢?今天我们就来讨论一下Linux目录的配置 Linux目录 ...