Answers for "filter a dataframe by the index"

0

filter dataframe by index

Filter_df  = df[df.index.isin(my_list)]
Posted by: Guest on July-27-2021
0

pandas series filter by index

import pandas as pd
series= pd.Series({'temp1':12,'temp2':23, 'temp3':31, 'temp4':42})
# assuming you want to print only temp4
print(series[series.index=="temp4"])
Posted by: Guest on August-30-2021

Code answers related to "filter a dataframe by the index"

Browse Popular Code Answers by Language