Hi I have a table (see screenshot for an extract of it - it has many more rows) in pandas and wish to pull out unique 'author_id' and then run a function to pull details associated with each ID.
I extract the list of unique ids by:
unique_ids = df['author_id'].unique()
Then I attempt to run:
df['author_id'].unique().apply(some_function)
Where 'some_function' takes the 'author_id' and returns some info. But I get the error:
AttributeError: 'numpy.ndarray' object has no attribute 'apply'
So I am resorting to:
[some_function(author_id) for author_id in unique_ids]
Which works but isnt the efficient/vectorised way of doing this.
What is the way to do this in a vectorised way?
Thanks in advance!