网站开发人员的行业分析电脑版网站制作公司
- 作者: 五速梦信息网
- 时间: 2026年03月21日 07:36
当前位置: 首页 > news >正文
网站开发人员的行业分析,电脑版网站制作公司,成都平面设计公司,达州市做网站重点关注本文思路#xff0c;用python分析#xff0c;方便大家实验复现#xff0c;代码每次都用全量的#xff0c;其他工具自行选择。 全文3000字#xff0c;阅读10min#xff0c;操作1小时 企业案例实战欢迎关注专栏 每日更新#xff1a;https://blog.csdn.net/cciehl/… 重点关注本文思路用python分析方便大家实验复现代码每次都用全量的其他工具自行选择。 全文3000字阅读10min操作1小时 企业案例实战欢迎关注专栏 每日更新https://blog.csdn.net/cciehl/category_12615648.html 背景 一家电商公司希望分析其过去一年的各项成本包括材料、劳动力、市场营销、固定成本和杂项支出。目标是了解成本结构识别成本控制和优化的机会。 实施步骤 首先收集并整理全年各月份的成本数据。 使用Python的数据分析和可视化库如Pandas和Matplotlib进行分析或者其他工具 对生成的图表进行深入分析提取关键洞察。 成本数据 每个月提供了五种成本类型材料、劳动力、市场营销、固定成本和杂项支出的具体数字和对应的用量并计算了每个月的总成本 import pandas as pd import numpy as np
设置随机数种子以确保数据的一致性
np.random.seed(42)
创建模拟的月份数据
months [January, February, March, April, May, June,July, August, September, October, November, December]
创建不同成本类型的模拟数据包括总成本和用量
data {Month: months,Material Cost (\(): np.random.randint(10000, 30000, size12),Material Quantity: np.random.randint(100, 300, size12),Labor Cost (\)): np.random.randint(8000, 25000, size12),Labor Hours: np.random.randint(200, 500, size12),Marketing Cost (\(): np.random.randint(5000, 15000, size12),Marketing Campaigns: np.random.randint(1, 5, size12),Fixed Cost (\)): np.random.randint(4000, 8000, size12),Fixed Assets: np.random.randint(10, 20, size12) }
转换为DataFrame
cost_df pd.DataFrame(data)
pd.set_option(expand_frame_repr, False)
print(cost_df) 初步的分析
分析方法: 初始分析仅涉及计算每个月的总成本和成本构成并通过简单的趋势图展示。 成本构成组成图可以看到主要的成本应该是材料费用但是具体占比多少其实还看不清楚然后波动趋势的话 因为组合型柱形图没法做每个月的对比 成本构成趋势图如果仔细看的话可以看到材料费用的波动比较大但是原因是什么不清楚因为费用跟使用情况有关系 这个是一个热力图可以看到材料和市场活动的波动会比较大导致的总成本的波动也比较大 问题: 缺乏细节总成本的展示忽略了成本结构的复杂性无法识别哪些成本类型对总支出的贡献最大。 无法识别趋势没有展示各成本类型随时间的变化趋势难以分析季节性变化或特定事件对成本的影响。 决策困难缺少深入分析管理层难以基于这些数据做出有针对性的成本控制或优化决策。
代码
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
np.random.seed(42)
Creating DataFrame from provided data
cost_data {Month: months,Material Cost (\(): np.random.randint(10000, 30000, size12),Labor Cost (\)): np.random.randint(8000, 25000, size12),Marketing Cost (\(): np.random.randint(5000, 15000, size12),Fixed Cost (\)): np.random.randint(4000, 8000, size12), } cost_df pd.DataFrame(cost_data) cost_df[Total Cost] cost_df[Material Cost (\()]cost_df[Labor Cost (\))]cost_df[Marketing Cost (\()]cost_df[Fixed Cost (\))] plt.figure(figsize(12, 6)) plt.plot(cost_df.index, cost_df[Total Cost], markero) plt.title(Monthly Total Cost - Unclear Visualization) plt.ylabel(Cost ($)) plt.xlabel(Month) plt.xticks() plt.tight_layout() plt.show()
Set Month as index
cost_df.set_index(Month, inplaceTrue)
1. Stacked Bar Chart for Monthly Costs
cost_df.plot(kindbar, stackedTrue, figsize(10, 6)) plt.title(Stacked Bar Chart of Monthly Costs) plt.ylabel(Amount ($)) plt.xticks(rotation45) plt.legend(titleCost Type) plt.tight_layout() plt.show()
2. Trend Line Chart for Each Cost Type
plt.figure(figsize(12, 6)) for column in cost_df.columns:plt.plot(cost_df.index, cost_df[column], markero, labelcolumn) plt.title(Trend Lines for Each Cost Type) plt.xticks(rotation45) plt.ylabel(Amount ($)) plt.legend() plt.tight_layout() plt.show()
3. Heatmap for Monthly Costs
Creating a new DataFrame suitable for heatmap
heatmap_data cost_df.T # Transpose to get cost types as rows and months as columns plt.figure(figsize(12, 6)) sns.heatmap(heatmap_data, cmapYlGnBu, annotTrue, fmtd) plt.title(Heatmap of Monthly Costs) plt.xlabel(Month) plt.ylabel(Cost Type) plt.tight_layout() plt.show() 改进后的分析 为了克服这些限制我们需要采用更合理的数据可视化方法首先是查看各项占比组合柱形图如果不展示各项占比这个图的会变得很难解读所以从图中可以看出材料费用的占比在30%-50%左右还有就是劳动力成本这两个成本需要重点分析。 代码 import matplotlib.pyplot as plt import pandas as pd import numpy as np np.random.seed(42) # 确保结果可复现 months [January, February, March, April, May, June, July, August, September, October, November, December]
使用提供的数据创建DataFrame
cost_data {Month: months,Material Cost (\(): np.random.randint(10000, 30000, size12),Labor Cost (\)): np.random.randint(8000, 25000, size12),Marketing Cost (\(): np.random.randint(5000, 15000, size12),Fixed Cost (\)): np.random.randint(4000, 8000, size12), } cost_df pd.DataFrame(cost_data)
计算每个月总成本
cost_df[Total Cost ($)] cost_df.drop(Month, axis1).sum(axis1)
计算各成本项占总成本的比例
for column in cost_df.columns[1:-1]: # 排除Month和Total Cost (\()cost_df[f{column} Percentage] (cost_df[column] / cost_df[Total Cost (\))]) * 100
绘制各成本项的柱状图
cost_df.set_index(Month).iloc[:, :4].plot(kindbar, stackedTrue, figsize(14, 7)) plt.title(Monthly Costs with Percentages) plt.ylabel(Cost ($))
添加占比标签
for i, month in enumerate(cost_df[Month]):total_cost cost_df.loc[i, Total Cost ($)]cumulative_height 0for column in cost_df.columns[1:5]: # 选择四个成本列cost cost_df.loc[i, column]percentage (cost / total_cost) * 100label_y_position cumulative_height cost / 2 # 计算标签的y位置plt.text(i, label_y_position, f{percentage:.1f}%, hacenter, colorwhite, fontsize9)cumulative_height cost plt.xticks(rotation45) plt.legend(titleCost Type) plt.tight_layout() plt.show() 接着需要去掉用量的影响因为成本金额大不一定有问题可能是量也比较大我们构建一个单位成本的指标单位成本是指对应成本总额除以相应的量度如材料成本除以材料量劳动力成本除以工时等。 这里是单位材料成本和单位劳动力成本可以看到在3月、10月的单位材料成本大涨经过分析发现这两个月进入了一批新的材料比以往的采购价都更贵。发现单位工时成本在2月和12月上涨比较多是因为这两个月招聘了高技术的人才之后下降是由于上线了平台系统提高了整体的工作效率。 单位成本代码 import matplotlib.pyplot as plt import pandas as pd import numpy as np
设置随机数种子以确保数据的一致性
np.random.seed(42)
创建模拟的月份和成本数据
months [Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec] data {Month: months,Material Cost (\(): np.random.randint(10000, 30000, size12),Material Quantity: np.random.randint(100, 300, size12),Labor Cost (\)): np.random.randint(8000, 25000, size12),Labor Hours: np.random.randint(200, 500, size12), } cost_df pd.DataFrame(data) cost_df[Unit Material Cost (\()] cost_df[Material Cost (\))] / cost_df[Material Quantity] cost_df[Unit Labor Cost (\()] cost_df[Labor Cost (\))] / cost_df[Labor Hours]
绘制没有网格线和边框的折线图
plt.figure(figsize(10, 6)) plt.plot(cost_df[Month], cost_df[Unit Material Cost (\()], labelUnit Material Cost (\))) plt.plot(cost_df[Month], cost_df[Unit Labor Cost (\()], labelUnit Labor Cost (\))) plt.title(Monthly Unit Cost Analysis) plt.xlabel(Month) plt.ylabel(Unit Cost ($)) plt.legend()
移除边框
plt.gca().spines[top].set_visible(False) plt.gca().spines[right].set_visible(False) plt.gca().spines[bottom].set_visible(False) plt.gca().spines[left].set_visible(False)
移除网格线
plt.grid(False) plt.show() 总结 除了要在展示的时候能更清晰的从图中看出具体的数值外我们在分析成本的时候需要去掉用量的因素的影响单位成本是一个常见的分析指标
- 上一篇: 网站开发人力成本做网站都需要会什么软件
- 下一篇: 网站开发人员的行业分析企业咨询端app
相关文章
-
网站开发人力成本做网站都需要会什么软件
网站开发人力成本做网站都需要会什么软件
- 技术栈
- 2026年03月21日
-
网站开发去哪里培训免费全能浏览器
网站开发去哪里培训免费全能浏览器
- 技术栈
- 2026年03月21日
-
网站开发强制使用急速内核雄安建设工程信息网站
网站开发强制使用急速内核雄安建设工程信息网站
- 技术栈
- 2026年03月21日
-
网站开发人员的行业分析企业咨询端app
网站开发人员的行业分析企业咨询端app
- 技术栈
- 2026年03月21日
-
网站开发人员调试百度seo优化是做什么的
网站开发人员调试百度seo优化是做什么的
- 技术栈
- 2026年03月21日
-
网站开发人员兼职购物网站如何建设
网站开发人员兼职购物网站如何建设
- 技术栈
- 2026年03月21日






