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 ...
随机推荐
- SpringCloud-day09-Feign与Hystrix整合
8.5.Feign 与 Hystrix整合 服务熔断服务降级彻底解耦 前面的代码,用@HystrixCommand fallbackMethod是很不好的,因为和业务代码耦合度太高,不利于维护,所以需 ...
- 深入理解C++11【4】
[深入理解C++11[4]] 1.基于范围的 for 循环 C++98 中需要告诉编译器循环体界面范围.如for,或stl 中的for_each: int main() { ] = { , , , , ...
- 从裸机到实时操作系统RTOS
最近有点闲,公司新年过后一直没有项目,手头上维护的两个程序也比较稳定. 想起来去年做的商业时钟,做了一半,销售反馈回来说,市场不明朗,不建议往下开展,就搁置了,趁着现在有空,把他捡起来. 原来的代码都 ...
- jquery的$(selector).each(function(index,element))和$.each(dataresource,function(index,element))的区别
$(selector).each(function(index,element)) 定义和用法 each() 方法规定为每个匹配元素规定运行的函数. $(selector).each(function ...
- C# 一些学习作业
下载地址:http://pan.baidu.com/s/1dEGCJdf 包括: 实现QQ旋转窗体功能 非“按角度旋转”,实现的是立体旋转. 实现QQ旋转窗体功能,窗口为不规则图像,打开时旋转180度 ...
- 腾讯2019年暑期实习生招聘在线笔试技术研究和数据分析方向第二题(python)
def printindex(n,arr): # n = int(input()) # arr = list(map(int,input().split(' '))) li1=[] li2=[] fo ...
- POJ-2236.WireleseNetwork.(并查集)
Wireless Network Time Limit: 10000MS Memory Limit: 65536K Total Submissions: 43199 Accepted: 178 ...
- 20175126《Java程序设计》第七周学习总结
# 20175126 2016-2017-2 <Java程序设计>第七周学习总结 ## 教材学习内容总结 - 本周学习方式主要为手动敲代码并理解内容学习. - 学习内容为教材第八章,本章主 ...
- JVM学习04:类的文件结构
JVM学习04:类的文件结构 写在前面:本系列分享主要参考资料是 周志明老师的<深入理解Java虚拟机>第二版. 类的文件结构知识要点Xmind梳理
- leedcode算法解题思路
1.两数之和 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标. 你可以假设每种输入只会对应一个答案.但是,你不能重复利用这个 ...