Consider every possible pair, remove NaN entries and obtain the linear regression I’m working with Python for the first time so I’ve few difficulties.

I’ve a csv file of data with 6 columns and 20 rows, some entries are ‘NaN’. What I’m trying to do is an interaction that would consider the first column vs the others (A vs B,C,D,E and F), then the second column with all the others (B vs C,D,E and F) etc (i.e compare every possible pair of the 6 columns), for each pair remove the NaN entries (so the number of rows for each final pair would be different) and calculate the linear regression.

I can obtain the results I’m looking for by considering each pair “manually”, but since I’ve quite a lot of DataFrames for which I’ve to do this procedure, it’d take a lot of time, so I’m hoping someone would help me with a faster method.

what I’m able to do is:

df=data1.dropna(subset=['A','B'])

lr_AB=linregress(df['A'],df['B'])

how do I iterate these two commands for every possible pair of columns?

Thank you so much.

Streaming approximate histograms in Go 