Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Visualizing HR Data with Matplotlib | Analyzing Employee Data
Python for HR Specialists

bookVisualizing HR Data with Matplotlib

メニューを表示するにはスワイプしてください

Data visualization is a vital tool for HR specialists because it transforms complex data into clear, actionable insights. In HR reporting, visualizations such as charts and graphs make it easier to spot trends, compare groups, and communicate findings to stakeholders who may not be familiar with raw data. By presenting employee information visually, you can quickly highlight key metrics like department sizes, gender distribution, and turnover rates. This approach not only streamlines decision-making but also helps ensure that important patterns in workforce data are not overlooked.

1234567891011
import matplotlib.pyplot as plt # Sample data: number of employees by department departments = ['Sales', 'Engineering', 'HR', 'Marketing'] employee_counts = [40, 55, 15, 20] plt.bar(departments, employee_counts, color='skyblue') plt.xlabel('Department') plt.ylabel('Number of Employees') plt.title('Employee Counts by Department') plt.show()
copy

In the code above, you start by importing the matplotlib.pyplot module, which provides functions for creating charts. Next, you define two lists: departments contains the department names, and employee_counts holds the number of employees in each department. The plt.bar function creates a bar chart using these lists, with the department names on the x-axis and the employee counts on the y-axis. You then add labels to the axes with plt.xlabel and plt.ylabel, and set a title for the chart using plt.title. Finally, calling plt.show() displays the chart in a new window.

12345678910
import matplotlib.pyplot as plt # Sample data: gender distribution genders = ['Male', 'Female', 'Non-binary'] counts = [60, 50, 5] plt.pie(counts, labels=genders, autopct='%1.1f%%', startangle=140, colors=['lightblue', 'pink', 'lightgreen']) plt.title('Gender Distribution Among Employees') plt.axis('equal') # Ensures pie is drawn as a circle plt.show()
copy

1. Why is data visualization useful in HR?

2. Which library is commonly used for plotting in Python?

3. Fill in the blank: To display a chart in matplotlib, use the _______ function.

question mark

Why is data visualization useful in HR?

すべての正しい答えを選択

question mark

Which library is commonly used for plotting in Python?

正しい答えを選んでください

question-icon

Fill in the blank: To display a chart in matplotlib, use the _______ function.

plt.saveplt.plotplt.open

クリックまたはドラッグ`n`ドロップして空欄を埋めてください

すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 2.  2

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

セクション 2.  2
some-alt