vault backup: 2024-03-16 17:41:18
This commit is contained in:
@@ -210,3 +210,31 @@ plt.show()
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
## 业务区域分布
|
||||
|
||||
```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()
|
||||
```
|
||||
|
||||

|
||||
|
||||
Reference in New Issue
Block a user