首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >表中的直方图

表中的直方图
EN

Stack Overflow用户
提问于 2021-04-25 02:41:17
回答 2查看 243关注 0票数 0

Table

嗨,我正试着用上面的表格做一个直方图,下面是我的代码。

代码语言:javascript
复制
def histograms(t):
    salaries = t.column('Salary')
    salary_bins = np.arange(min(salaries), max(salaries)+1000, 1000)
    t.hist('Salary', bins=salary_bins, unit='$')
    
histograms(full_data)

但它不能正确显示。你能帮帮我吗?

Histogram

EN

Stack Overflow用户

发布于 2021-04-25 19:41:42

这就是你要找的东西吗?

代码语言:javascript
复制
import matplotlib.pyplot as plt
def histograms(t):
    _min = min(t['salary'])
    _max = max(t['salary'])
    bins = int((_max - _min) / 1000) # dividing the salary range in bins of 1000 each
    plt.hist(t['salary'], bins = bins)
histograms(df)
票数 0
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67246261

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档