Finding the maximum number of id's among all weeks available
Instead of iterating through each possible week and filtering your dataframe, you should use df.groupby and work from there using convenience methods on the results:

df.groupby('week').id.nunique().max()