From 2ccc124845517922e81bfb8f7c535a5c8e1adbcc Mon Sep 17 00:00:00 2001 From: kefandaoren Date: Sat, 16 Mar 2024 17:41:18 +0800 Subject: [PATCH] vault backup: 2024-03-16 17:41:18 --- Extras/Omnivore/数据处理过程.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Extras/Omnivore/数据处理过程.md b/Extras/Omnivore/数据处理过程.md index e07cf800..2ca0a71e 100644 --- a/Extras/Omnivore/数据处理过程.md +++ b/Extras/Omnivore/数据处理过程.md @@ -210,3 +210,31 @@ plt.show() ![image.png|600](https://image.kfdr.top/i/2024/03/16/65f5617bb2942.png) ![image.png|600](https://image.kfdr.top/i/2024/03/16/65f5625b9cac2.png) + + +## 业务区域分布 + +```python +import pandas as pd +import matplotlib.pyplot as plt +plt.rcParams['font.sans-serif'] = ['Microsoft YaHei'] + +# Load the Excel file +data = pd.read_excel('E:/Projects/analyse/pythonProject/merged_data.xlsx') + +# Correcting the approach based on the updated description for the '区域' column + +# Update the DataFrame to reflect the correct column name and values for categorization +data['Regional Category'] = data['区域'].map({'市内': '省内', '广东省内': '省内', '国际': '省外', '港澳台': '省外', '广东省外': '省外'}) + +# Calculate the distribution of the new categories +regional_category_distribution = data['Regional Category'].value_counts() + +# Generate a pie chart to show the updated regional distribution of the business +plt.figure(figsize=(8, 8)) +plt.pie(regional_category_distribution, labels=regional_category_distribution.index, autopct='%1.1f%%', startangle=140, colors=['skyblue', 'orange']) +plt.title('业务区域分布') +plt.show() +``` + +![image.png|600](https://image.kfdr.top/i/2024/03/16/65f568159bb5c.png)