import pandas as pd
df = pd.DataFrame({'ticker':['x','x','y','z','z'],
'bid':[1,2,np.nan,2,np.nan]})
Using pandas .dropna()
is there anyway to drop the rows from a specified index range or subset of the data? For example in the DataFrame above, if I want to only drop rows in the index for where ticker equals 'z'
. This would hopefully return:
ticker bid
x 1
x 2
y np.nan
z 2