-
Notifications
You must be signed in to change notification settings - Fork 22
Problem #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Problem #9
Conversation
zmiany w pliku
cw_8.py
Outdated
|
|
||
| df_m = df[df["Płeć"] == "M"] | ||
| df_k = df[df["Płeć"] == "K"] | ||
| print("\nE\n" + str(df_m["Liczba"].sum()) + "\n" + str(df_k["Liczba"].sum())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tutaj można użyć groupby jak w przykładach print(df.groupby(['Kontynent']).agg({'Populacja':['sum']})), ale tak jak jest też jest ok. Łatwiej wtedy by było w dalszym zadaniu ;)
cw_8.py
Outdated
| print(str(x) + " " + str(df_k["Imię"]) + "\n " + str(df_m["Imię"]) + "\n") | ||
|
|
||
| # G | ||
| # w tym punkcie mam problem aby wyciągnąć te konkretne maksymalne wartości |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To samo co wyżej można użyć w tym punkcie. Podobna zasada jak jest opisana tutaj: https://stackoverflow.com/questions/52863026/pandas-return-month-containing-max-value-for-each-year
cw_8.py
Outdated
| max = df["Liczba"].max() | ||
| d = df.groupby(["Imię"]).agg({"Liczba":['sum']}) | ||
| d = df[d["liczba"] == max] | ||
| print(d["Imię"]) No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mając max z grupowanych przedziałów wyciągnięcie maxa z całego okresu nie powinno być problemem
|
Kilka rzeczy było robionych trochę na około,ale w przypadku kolokwium by było to zaliczone. Zrobienie wszystkich punktów w ten sposób jest skomplikowane. Wykorzystanie groupby powinno ułatwić temat. W razie dalszych problemów proszę puścić commita i odezwać się do mnie to spróbuję pomóc |
abador
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
komentarze wyżej w razie pytań proszę pisać na teamsach
No description provided.