mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-06 19:00:52 -04:00
85 lines
5.8 KiB
Markdown
85 lines
5.8 KiB
Markdown
---
|
||
id: 5e46f7e5ac417301a38fb929
|
||
title: Аналізатор демографічних даних
|
||
challengeType: 10
|
||
forumTopicId: 462367
|
||
dashedName: demographic-data-analyzer
|
||
---
|
||
|
||
# --description--
|
||
|
||
Ви будете <a href="https://replit.com/github/freeCodeCamp/boilerplate-demographic-data-analyzer" target="_blank" rel="noopener noreferrer nofollow">працювати над цим проєктом з нашим стартовим кодом Replit</a>.
|
||
|
||
- Start by importing the project on Replit.
|
||
- Next, you will see a `.replit` window.
|
||
- Select `Use run command` and click the `Done` button.
|
||
|
||
|
||
Ми досі розробляємо інтерактивну частину навчальної програми з Python. Наразі є декілька відео на ютуб-каналі freeCodeCamp.org, які навчать всього необхідного для виконання цього проєкту:
|
||
|
||
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a> (14 hours)
|
||
|
||
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">How to Analyze Data with Python Pandas</a> (10 hours)
|
||
|
||
# --instructions--
|
||
|
||
У цьому завдання ви повинні проаналізувати демографічні дані за допомогою Pandas. Вам надається набір демографічних даних, отриманих з бази даних перепису населення 1994 року. Ось приклад того, як виглядають дані:
|
||
|
||
```markdown
|
||
| | age | workclass | fnlwgt | education | education-num | marital-status | occupation | relationship | race | sex | capital-gain | capital-loss | hours-per-week | native-country | salary |
|
||
|---:|------:|:-----------------|---------:|:------------|----------------:|:-------------------|:------------------|:---------------|:-------|:-------|---------------:|---------------:|-----------------:|:-----------------|:---------|
|
||
| 0 | 39 | State-gov | 77516 | Bachelors | 13 | Never-married | Adm-clerical | Not-in-family | White | Male | 2174 | 0 | 40 | United-States | <=50K |
|
||
| 1 | 50 | Self-emp-not-inc | 83311 | Bachelors | 13 | Married-civ-spouse | Exec-managerial | Husband | White | Male | 0 | 0 | 13 | United-States | <=50K |
|
||
| 2 | 38 | Private | 215646 | HS-grad | 9 | Divorced | Handlers-cleaners | Not-in-family | White | Male | 0 | 0 | 40 | United-States | <=50K |
|
||
| 3 | 53 | Private | 234721 | 11th | 7 | Married-civ-spouse | Handlers-cleaners | Husband | Black | Male | 0 | 0 | 40 | United-States | <=50K |
|
||
| 4 | 28 | Private | 338409 | Bachelors | 13 | Married-civ-spouse | Prof-specialty | Wife | Black | Female | 0 | 0 | 40 | Cuba | <=50K |
|
||
```
|
||
|
||
Ви повинні використати Pandas, щоб відповісти на наступні запитання:
|
||
|
||
- How many people of each race are represented in this dataset? This should be a Pandas series with race names as the index labels. (`race` column)
|
||
- What is the average age of men?
|
||
- What is the percentage of people who have a Bachelor's degree?
|
||
- What percentage of people with advanced education (`Bachelors`, `Masters`, or `Doctorate`) make more than 50K?
|
||
- What percentage of people without advanced education make more than 50K?
|
||
- What is the minimum number of hours a person works per week?
|
||
- What percentage of the people who work the minimum number of hours per week have a salary of more than 50K?
|
||
- What country has the highest percentage of people that earn >50K and what is that percentage?
|
||
- Identify the most popular occupation for those who earn >50K in India.
|
||
|
||
Використайте початковий код у файлі `demographic_data_analyzer`. Оновіть код, щоб для всіх змінних, для яких встановлено значення "None", було встановлено відповідне обчислення або код. Заокругліть усі десяткові дроби до найближчих десятків.
|
||
|
||
Для вас складені модульні тести у `test_module.py`.
|
||
|
||
## Розробка
|
||
|
||
Для розробки ви можете використати `main.py`, щоб протестувати свій код. Натисніть кнопку «run» і `main.py` запуститься.
|
||
|
||
## Тестування
|
||
|
||
Ми імпортували тести з `test_module.py` до `main.py` для вашої зручності. Тести запустяться автоматично, коли ви натиснете на кнопку «run».
|
||
|
||
## Надсилання
|
||
|
||
Скопіюйте URL-адресу свого проєкту та відправте її до freeCodeCamp.
|
||
|
||
## Джерело даних
|
||
|
||
Dua, D. and Graff, C. (2019). <a href="http://archive.ics.uci.edu/ml" target="_blank" rel="noopener noreferrer nofollow">UCI Machine Learning Repository</a>. Irvine, CA: University of California, School of Information and Computer Science.
|
||
|
||
# --hints--
|
||
|
||
Проєкт повинен пройти усі тести Python.
|
||
|
||
```js
|
||
|
||
```
|
||
|
||
# --solutions--
|
||
|
||
```py
|
||
# Python challenges don't need solutions,
|
||
# because they would need to be tested against a full working project.
|
||
# Please check our contributing guidelines to learn more.
|
||
```
|