python - Comparing the content a List of pandas DataFrames -
i have list contains 3 pandas dataframes. dataframes have exact column names , have same length. compare entries of specific column in each dataframe. assuming list has:
list=[df1,df2,df3].
and each dataframe has following structure. df1 has structure
column1 column2 column3 4 3 4 4 5 7 7 6 6 8 6 4
df2 has structure
column1 column2 column3 4 3 4 7 5 7 7 6 5 8 6 4
df3 has structure
column1 column2 column3 4 3 5 4 1 7 7 6 6 8 6 4
i compare content of df1 column1 , column2(for each row) contain df2 (column1 , column2) , df3 (column1 , column2)
i wrote thought this:
for in range(len(list)):# iterate through list j in range(len(list[0].index.values)):# iterate through the whole dataframe #i like: if df1[column1][row1]=df2[column1][row1] .... # dont know how iterate through dataframes simulatanously compare content of of column 1 , column 2(for each row k) of df1 content of column 1 , column 2 of df2 , column 1 , column 2 of df3.
i stuck there
Comments
Post a Comment