What does [0] mean after calling .unique()? /u/micr0nix Python Education

I have inherited some code from a coworker who attempted to generate a prophet timeseries model. This particular line of code is confusing to me:

def run_prophet(df_sample): user_id = df_sample['USER_ID'].unique()[0] 

df_sample is a list of dataframes that was created by grouping raw data by USER_ID

submitted by /u/micr0nix
[link] [comments]

​r/learnpython I have inherited some code from a coworker who attempted to generate a prophet timeseries model. This particular line of code is confusing to me: def run_prophet(df_sample): user_id = df_sample[‘USER_ID’].unique()[0] df_sample is a list of dataframes that was created by grouping raw data by USER_ID submitted by /u/micr0nix [link] [comments] 

I have inherited some code from a coworker who attempted to generate a prophet timeseries model. This particular line of code is confusing to me:

def run_prophet(df_sample): user_id = df_sample['USER_ID'].unique()[0] 

df_sample is a list of dataframes that was created by grouping raw data by USER_ID

submitted by /u/micr0nix
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *