![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据分析
文章平均质量分 53
菩提树下的承诺
人生苦短,我用python
展开
-
数据分析bit
import jsonfrom collections import defaultdictfrom collections import Counterfrom pandas import DataFrame, Seriesimport pandas as pdimport numpy as npimport matplotlib.pyplot as pltpath = ‘exam...翻译 2019-03-13 15:27:08 · 240 阅读 · 0 评论 -
数据分析电影
import pandas as pdimport threadingfrom pandas import Seriesimport timestart = time.perf_counter()unames = [‘user_id’, ‘gender’, ‘age’, ‘occupation’, ‘zip’]users = pd.read_table(‘users.dat’, sep...翻译 2019-03-12 19:25:17 · 526 阅读 · 0 评论 -
数据分析随机漫步
from random import choiceimport matplotlib.pyplot as pltclass Randonmwalk():“”“一个生成随机漫步数据的类”""def __init__(self, num_points=5000): """初始化随机漫步的属性""" self.num_points =翻译 2019-03-13 15:27:36 · 247 阅读 · 0 评论 -
数据分析折线图
import matplotlib.pyplot as pltinput_values = [1, 2, 3, 4, 5]squares = [1, 4, 9, 16, 25]x_value = list(range(1, 1001))y_value = [x ** 2 for x in x_value]plt.plot(input_values,squares,linewidth=5)...翻译 2019-03-13 15:28:25 · 1838 阅读 · 0 评论 -
数据分析掷色子
from random import randintimport pygalclass Die():“”“表示一个色子的类”""def __init__(self, num_sides=6): """默认色字为六面""" self.num_sides = num_sidesdef roll(self): &翻译 2019-03-13 15:28:47 · 314 阅读 · 0 评论 -
数据分析气温表
import csvimport matplotlib.pyplot as pltfrom datetime import datetimeimport timefilename = ‘sitka_weather_07-2014.csv’with open(filename) as f:reader = csv.reader(f)header_row = next(reader)d...翻译 2019-03-13 15:28:59 · 425 阅读 · 0 评论 -
数据分析人口地图
import jsonimport pygal.maps.world将数据加载到一个列表中filename = ‘population_data.json’with open(filename) as f:pop_data = json.load(f)# 打印每个国家2010年的人数for pop_dict in pop_data:if pop_dict[‘Year’] == ‘...翻译 2019-03-13 15:29:12 · 788 阅读 · 0 评论 -
数据分析世界地图
import pygalimport jsonimport pygal.maps.worldfrom pygal.style import LightColorizedStyle as LCS, RotateStyle as RSfilename = ‘population_data.json’with open(filename) as f:pop_data = json.load(...翻译 2019-03-13 15:29:26 · 858 阅读 · 0 评论