Skip to content

Koltunov Matvey#7

Open
echanatwell wants to merge 5 commits intorailbotan:mainfrom
echanatwell:koltunov-numpy
Open

Koltunov Matvey#7
echanatwell wants to merge 5 commits intorailbotan:mainfrom
echanatwell:koltunov-numpy

Conversation

@echanatwell
Copy link
Copy Markdown

No description provided.

"indexes = np.argmax(matrix, axis=1)\n",
"print(indexes)\n",
"print(...)"
"print([matrix[i, j] for i, j in enumerate(indexes)])"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вместо этого np.max(matrix, axis=1)

@railbotan
Copy link
Copy Markdown
Owner

5 баллов

"id": "rK9SwvI_utTj"
},
"source": [
"**6. Правда ли, что люди, которые получают больше 50k, имеют как минимум высшее образование? (признак *education – Bachelors, Prof-school, Assoc-acdm, Assoc-voc, Masters* или *Doctorate*)**"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ed = ['Bachelors', 'Prof-school', 'Assoc-acdm', 'Assoc-voc', 'Masters', 'Doctorate']
data[data.education.isin(ed)].salary.value_counts()['<=50K'] == 0

"id": "cn-jYXhzutTl"
},
"source": [
"**8. Среди кого больше доля зарабатывающих много (>50K): среди женатых или холостых мужчин (признак *marital-status*)? Женатыми считаем тех, у кого *marital-status* начинается с *Married* (Married-civ-spouse, Married-spouse-absent или Married-AF-spouse), остальных считаем холостыми.**"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data['married'] = data['marital-status'].apply(lambda row: 1 if row.startswith('Married') else 0)
data[data.sex == 'Male'].groupby('married').salary.value_counts(normalize=True)

@railbotan
Copy link
Copy Markdown
Owner

5 баллов

"id": "HgiqBXtb05qR"
},
"source": [
"data.groupby('Sex')['Age'].min()"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data[data.Year == 1992].groupby('Sex')['Age'].min()

},
"source": [
"len(data[(data['Sex'] == 'M') & (data['Year'] == 2012) & (data['Sport'] == 'Basketball')]) / \\\n",
"len(data[(data['Sex'] == 'M') & (data['Year'] == 2012)])"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Забыли убрать дубликаты

"id": "Y754OGI-05q3"
},
"source": [
"len(data[(data['Year'] == 2008) & (data['Team'] == 'Switzerland') & (data['Medal'] == 'Gold')])"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не учтен теннис

@railbotan
Copy link
Copy Markdown
Owner

4 балла

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants