python data science handbook1
import numpy as np
import matplotlib.pyplot as plt
import seaborn; seaborn.set() rand = np.random.RandomState(42)
x = rand.rand(10,2) #数组
plt.scatter(x[:,0],x[:,1],s=100) #数组第一列为横坐标,第二列为纵坐标 s=100:散点大小
plt.show()
any list of dictionaries can be made into a DataFrame
import numpy as np
pd.DataFrame(np.random.rand(3,2),
columns=['foo','bar'],
index=['a','b','c'])
import pandas as pd
import numpy as np
class display(object):
"""Display HTML representation of multiple objects"""
template = """<div style="float: left; padding: 10px;">
<p style='font-family:"Courier New", Courier, monospace'>{0}</p>{1}
</div>"""
def __init__(self, *args):
self.args = args def _repr_html_(self):
return '\n'.join(self.template.format(a, eval(a)._repr_html_())
for a in self.args) def __repr__(self):
return '\n\n'.join(a + '\n' + repr(eval(a))
for a in self.args)
df1 = pd.DataFrame({'employee': ['Bob', 'Jake', 'Lisa', 'Sue'],
'group': ['Accounting', 'Engineering', 'Engineering', 'HR']})
df3 = pd.DataFrame({'name': ['Bob', 'Jake', 'Lisa', 'Sue'],
'salary': [70000, 80000, 120000, 90000]})
display('df1', 'df3', 'pd.merge(df1, df3, left_on="employee", right_on="name")') #display 允许显示多个结果
python data science handbook1的更多相关文章
- Python Data Science Toolbox Part 1 Learning 1 - User-defined functions
User-defined functions from:https://campus.datacamp.com/courses/python-data-science-toolbox-part-1/w ...
- Comprehensive learning path – Data Science in Python深入学习路径-使用python数据中学习
http://blog.csdn.net/pipisorry/article/details/44245575 关于怎么学习python,并将python用于数据科学.数据分析.机器学习中的一篇非常好 ...
- 学习笔记之Intermediate Python for Data Science | DataCamp
Intermediate Python for Data Science | DataCamp https://www.datacamp.com/courses/intermediate-python ...
- Intermediate Python for Data Science learning 2 - Histograms
Histograms from:https://campus.datacamp.com/courses/intermediate-python-for-data-science/matplotlib? ...
- A Complete Tutorial to Learn Data Science with Python from Scratch
A Complete Tutorial to Learn Data Science with Python from Scratch Introduction It happened few year ...
- 40 Questions to test your skill in Python for Data Science
Comes from: https://www.analyticsvidhya.com/blog/2017/05/questions-python-for-data-science/ Python i ...
- 【转】Comprehensive learning path – Data Science in Python
Journey from a Python noob to a Kaggler on Python So, you want to become a data scientist or may be ...
- 学习Data Science/Deep Learning的一些材料
原文发布于我的微信公众号: GeekArtT. 从CFA到如今的Data Science/Deep Learning的学习已经有一年的时间了.期间经历了自我的兴趣.擅长事务的探索和试验,有放弃了的项目 ...
- 【Repost】A Practical Intro to Data Science
Are you a interested in taking a course with us? Learn about our programs or contact us at hello@zip ...
随机推荐
- Jmeter Dash Report(HTML Report)删除Hits Per Second graph的方法
通过命令行 Non GUI的方式执行jmeter的jmx脚本可以生成HTML Report(Dash Report). 这个report默认自带了很多种图表报告,比如statistics,Over t ...
- linux/centOS 下安装 ngnix
Nginx 是一款轻量级的 Web 服务器/反向代理服务器,比较流行,建议在 Linux 下安装运行. Nginx 需要的依赖 它们包括:gcc,openssl,zlib,pcre(可通过rpm -q ...
- centos7 安装mongodb
1. 创建mongodb数据,日志,配置文件存放目录# mkdir /data# tar xzf mongodb-linux-x86_64-rhel70-4.0.8.tgz# mv mongodb- ...
- [Solution] 969. Pancake Sorting
Difficulty: Medium Problem Given an array A, we can perform a pancake flip: We choose some positive ...
- Ubuntu iso下载地址(14、16、18)
Ubuntu镜像,快速下载 ubuntu 14.04: http://mirrors.aliyun.com/ubuntu-releases/14.04/ubuntu 16.04: http://mir ...
- 浙江省赛之Singing Everywhere
题目:http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5996 方法: 在大佬的指导下完成. 寻找峰值,找到一共k个 ...
- Collection<T> 的一个坑
当前所在的公司偏好使用 Collection<T>(System.Collections.ObjectModel), 这货比起List<T>不仅少了很多实用方法, 而且还有一个 ...
- java之servlet学习基础(二)
上一次写到Servlet的实现方法,主要还是通过继承HttpServlet来实现Servlet.下面主要是回顾一下HttpServletRequest和HttpServletResponse对象中的一 ...
- 非root用户启动redis容器报错mkdir: cannot create directory '/bitnami/redis': Permission denied
问题:使用docker启动容器时,报错如下 zh@debian:~/testPath$ docker-compose up redis Starting testpath_redis_1 ... do ...
- 每天写两个的java常见面试题—final 和static 的用法
第一次写随笔,可能写的比较乱,更多的是作为自己记忆一些知识的方式.所有记录的东西都是自己的一些理解,很多语言可能还是从其他大牛的博客里面搬过来的. 一.static的作用: static的的作用从三个 ...