Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
Of the first 36 elements, the halogens are fluorine ( pm), chlorine ( pm) and bromine ( pm). Write the filter and the sort that list them with the largest atom first. Which element comes first, and what is its radius?
A pandas DataFrame holds one element in each row. df[condition] keeps the rows where the condition is true; join conditions with &, each in brackets. sort_values("col", ascending=False) sorts from largest to smallest. set_index("symbol").loc[row, col] looks up one value. A computed column is one line, such as df["ie_eV"] = df["ie"] / 96.49.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Step 1. Filter. df[df["group"] == 17] keeps fluorine, chlorine and bromine.
Step 2. Sort. .sort_values("radius", ascending=False) puts the largest first: bromine, chlorine, fluorine.
Step 3. Read the first row. Bromine, pm. Down the group each halogen adds a shell, so the atoms grow.
Answer: bromine first, with a radius of pm.
Log in to join the discussion.
Loading…