共 55 篇文章 |
|
plt.title(u"性别比例分析")plt.xticks((0,1),(u''男'',u''女''))rect = plt.bar(left = (0,1),height = (1,0.5),width = 0.35,align="center")这里,我们需要用到一个通用的方法:def autolabel(rects): for rect in rects: height = rect.get_height() plt.text(rect... 阅25 转1 评0 公众公开 16-12-10 19:46 |
Pandas读取数据到Dataframe.Python中用Pandas进行数据分析,最常用的就是Dataframe数据结构,之前写过一篇文章介绍Pandas的基本用法,后来有些朋友问Pandas怎么从数据库中读取数据,怎么从文件中读取数据之类的问题,因此单独开篇文章介绍Pandas如何读取数据到Dataframe。Pandas读取csv文件数据Pandas读取csv文件中的数据要简单的多,不用额外安... 阅29 转1 评0 公众公开 16-12-10 16:02 |
阅21 转1 评0 公众公开 16-12-09 12:58 |
Series?Series索引( obj[...] )的工作原理类似与NumPy索引,除了可以使用Series的索引值,也可以仅使用整数来索引。In [102]: obj = Series(np.arange(4.), index=[''a'', ''b'', ''c'', ''d''])In [103]: obj[''b''] In [104]: obj[1]Out[103]: 1.0 Out[104... 阅170 转2 评0 公众公开 16-12-08 20:17 |
不同的数据库你需要下载不同的DB API模块,例如你需要访问Oracle数据库和Mysql数据,你需要下载Oracle和MySQL数据库模块。/usr/bin/python# -*- coding: UTF-8 -*-import MySQLdb# 打开数据库连接db = MySQLdb.connect("localhost","codecloud","test123","TESTDB" )# 使用cursor()方法获取操作游标 c... 阅62 转1 评0 公众公开 16-12-08 16:53 |
R处理大数据聚合操作与MYSQL比较 本帖最后由 bsspirit 于 2012-12-5 14:04 编辑 zhlight 发表于 2012-12-5 12:54 R会把所有的对象读存入虚拟内存中。我读入的数据集,在内存占用1.5G空间,这是可以接受的内存用量。 阅43 转2 评0 公众公开 16-12-03 10:03 |
3、windows:控制面板->管理工具->数据源(ODBC)->双击->添加->选中mysqlODBC driver一项填写:data source name 一项填入你要使用的名字,自己随便命名,例如:mysql_data;description一项随意填写,例如mydataTCP/IP Server 填写本机服务器IP,一般为:127.0.0.1user 填写你的mysql用户名password 填写你的mysql密码然后数据... 阅74 转1 评0 公众公开 16-12-03 09:49 |
这里与之相关的有一个unicode()函数,用法如下str="来搞基"str=unicode(str,"utf-8")print str与u的区别是,这里用unicode将str转换为unicode编码,需要正确指定第二个参数,这里的utf-8是我test.py脚本自身的文件字符集,默认的可能是ansi。str=unicode(str,"gb2312") #这里的gb2312就是str的实际字符集,我们... 阅1015 转3 评0 公众公开 16-11-29 15:24 |
阅606 转1 评0 公众公开 16-11-29 14:14 |
A df2.boxplotdf2.abs df2.B df2.cummaxdf2.between_time df2.cummindf2.bfill df2.cumproddf2.blocks df2.cumsumdf2.bool df2.In [123]: df["grade"] = df["raw_grade"].astype("category")In [124]: df["... 阅171 转1 评0 公众公开 16-11-28 08:45 |