pandas

Iterate Dataframe

for index, row in df.iterrows():
    print(row['name'], row['age'])
for col in df.columns:
    print(col)

using index

for ind in df.index:
    print(df['Name'][ind], df['Stream'][ind])

using loc[] or iloc[]

for i in range(len(df)):
    print(df.loc[i, "Name"], df.loc[i, "Age"])
    
for i in range(len(df)):
    print(df.iloc[i, 0], df.iloc[i, 2])

using apply method

Filter dataframe

Pandas where() method: Filtering with Conditions

Filter Rows that Contain a Specific String

Filter Rows that Contain a String in a List

Filter rows that conatin a partial string

Filter by a List of strings

Get Column Name

Last updated