Skip to content

Conversation

@lukaszbajkowski
Copy link

No description provided.

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()))
Copy link
Owner

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
Copy link
Owner

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
Copy link
Owner

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

@abador
Copy link
Owner

abador commented May 27, 2020

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

Copy link
Owner

@abador abador left a 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

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