Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Series.apply + Lambda Function¶
DataFrame.apply + Lambda Function¶
axis=1: apply the lambda function on each row
List Comprehension¶
numpy.where¶
numpy.where is vectorized ifelse.
Categorical Data in Pandas
Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Get Location of Max Value in a Pandas Series
Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
idxmax Return the row label of the maximum value.
argmax: Return int position of the largest value in the Series.
Polars Series in Rust
Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Get Index of True Values of a Sequence in Python
Using Boolean Indexing¶
Understand Index in pandas
Comments¶
- There are multiple ways to update the index of a DataFrame or Series.
First,
you can assign a new
Series
orIndex
object to the index of a DataFrame or Series. Or you can use methods such asDataFrame.set_index
orDataFrame.reset_index
.DataFrame.reset_index
resets the index of a DataFrame/Series to an integer index starting from 0. The old index is kept by default but can be dropped using the optiondrop=True