human
Extract first and last row of a dataframe in pandas
assistant
Here is some code to extract first and last row of a dataframe `df`

pd.concat([df.head(1), df.tail(1)])

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.