August 4 - Learning one or two things
Today I got the covid vaccine. Thank goodness that I was able to find a spot in Linares (a county about 1.5 hours away from Monterrey) and I there I went and received the first shot of AstraZeneca. And man ... it hit me strong. Right now that I am writing the post, I have some fever, dizzyness and a little bit of cough.
Well now coming back to our work. I wasn't able to work today in the tasks that I desired but well, I didn't feel like being productive today. Hopefully tomorrow will be a better day. Still, I did some Juypter notebook
excercises and that gave some cool functions that I didn't know from Pandas
. Here are some notes about useful commands with Pandas
.
The set()
function as in files = set(joined_pr['file])
is very userful for selecting the unique values of a set. For example if I want to know the elements present in an array, that's how I would be using it.
When using pd.DataFrame.groupby()
function, if a list of column names is being called for groupping and if some processing is needed in a specific column, then it can be used in the following way:
counts = by_author.groupby([by_author['user'], by_author['date'].dt.year]).agg({'pid': 'count'}).reset_index()
Here, dt.year
is being applied to the date
column, and aggregation is done with the count
function by using agg()
method.