
数据分析
红尘and渡口
一只特立独行的猪
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
不同长度的列表构建DataFrame
a = [1, 2, 3]b = [1, 2]c = [1, 2, 3, 4]df = pd.concat([pd.DataFrame({'a': a}), pd.DataFrame({'b':b}), pd.DataFrame({'c':c})], axis=1)df.fillna(0)原创 2020-01-22 17:32:19 · 10093 阅读 · 0 评论 -
Python之NumPy(axis=0 与axis=1)区分
转自:http://blog.youkuaiyun.com/wangying19911991/article/details/73928172 https://www.zhihu.com/question/58993137python中的axis究竟是如何定义的呢?他们究竟代表是DataFrame的行还是列?考虑以下代码:>>>df = pd.D...转载 2019-03-14 20:42:59 · 128 阅读 · 0 评论 -
python遍历获取文件:for (root, dirs, files) in walk(roots):
注意事项:这是个遍历类似于生成器的感觉,一层一层遍历直接上代码:path = 'F:/KuGou'def file_name(file_dir): a = 1 for root, dirs, files in os.walk(file_dir):#遍历文件夹、根目录、目录文件夹、目录里的文件 print(root) print("*****...原创 2019-03-13 14:28:47 · 8974 阅读 · 1 评论 -
Pandas:DataFrame的交集并集补集(列标签是相同的)
df1 = pd.DataFrame([['张三', 10, '男'], ['李四', 11, '男'], ['王五', 11, '女'], ['赵六', 10, '女'], ['王七', 11, '男'], ['M...原创 2019-04-10 15:23:44 · 15786 阅读 · 5 评论 -
DataFrame 中某一列是元组形式拆成两列
1.有元组的拆分df3_new.head()migrate number1 migrate 0 -11441.0 (北京, 廊坊) 1 -9745.0 (深圳, 惠州) 2 -7393.0 (上海, 苏州) 3 -7053.0 (东莞, 惠州) 4 -4451.0 (北京, 保定) 想把...原创 2019-04-15 19:43:25 · 4512 阅读 · 0 评论 -
可视化Matplotlib
API:https://matplotlib.org/api/pyplot_api.html#coding:utf-8import numpy as npimport matplotlib.pyplot as pltfrom pylab import *# 定义数据部分x = np.arange(0., 10, 0.2)y1 = np.cos(x)y2 = np.sin...原创 2019-06-06 11:07:12 · 269 阅读 · 0 评论 -
DataFrame填充缺失值,用其它列填充缺失值
填补缺失值,前一列向后填充def fillother(a): b = a.fillna(0) w = [] #防止列索引格式不一致 for m in b.columns: m = str(m) w.append(m) #b.columns = ['省', '市', 2010, 2011, 2012, 2013, ...原创 2019-06-23 17:51:02 · 11210 阅读 · 0 评论 -
Markdown 语法下插入表格
1.在world或者Excel中完成表格制作2.用HTML在线网址将表格转成html格式网址:http://pressbin.com/tools/excel_to_html_table/index.html3.将第一个<table>变成<table class="table table-bordered table-striped table-condensed">...原创 2019-09-25 11:01:55 · 1518 阅读 · 0 评论