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版本必须 ...
随机推荐
- ios shell打包脚本 xctool
#! /bin/bash project_path=$() project_config=Release output_path=~/Desktop build_scheme=YKTicketsApp ...
- [poj1797]Heavy Transportation<最大生成树prim&kruskal>
题目链接:http://poj.org/problem?id=1797 题意:给定n个点,m条边,每条边连接两点切有权值.求点1到点n的路径的上的最小边的值最大... 翻别人博客找到的题,方法挺多的, ...
- [codevs1227]草地排水<Dinic网络流最大流>
题目链接:http://codevs.cn/problem/1993/ https://www.luogu.org/problemnew/show/P2740 之前一直都没去管网络流这算法,但是老师最 ...
- NCEP CFSR数据下载
一.简介 CFSR(Climate Forecast SystemReanalysis)再分析资料使用了 GEOS-5(Goddard EarthObserving System)大气模式与资料同化系 ...
- C 旅店
时间限制 : - MS 空间限制 : - KB 评测说明 : 1s,256m 问题描述 一条笔直的公路旁有N家旅店,从左往右编号1到N,其中第i家旅店的位置坐标为Xi.旅人何老板总在赶路.他白天 ...
- VS2019中QT连接及使用
23:27:43 2019-08-09 qt连接VS 连接前提是在下载qt的时候将 MSVC 2017装上 点击扩展 选择管理扩展 搜索qt 选择下载 之后下载结束并重新打开后 会弹出一个 QT o ...
- 从JDK源码学习Hashmap
这篇文章记录一下hashmap的学习过程,文章并没有涉及hashmap整个源码,只学习一些重要部分,如有表述错误还请在评论区指出~ 1.基本概念 Hashmap采用key算hash映射到具体的valu ...
- jQuery extend()和jQuery.fn.extend()区别和详解
1.认识jQuery extend()和jQuery.fn.extend() jQuery的API手册中,extend方法挂载在jQuery和jQuery.fn两个不同对象上方法,但在jQuery内部 ...
- kubernates常用命令
Kubernetes常用操作命令 kubectl log //查看日志 $ kubectl log myapp-pod –c test kubectl get pods查看pod列表 [root@n ...
- 线程绑定cpu
#include <stdio.h> #include <pthread.h> #include <sys/sysinfo.h> #include <unis ...