I have several Pandas Series of unique strings:
First Series
P0A8V2
P36683
P15254
Second Series
P09831
P0AFG8
I want to write a textfile that looks like this (tab seperator):
P0A8V2 P36683
P0A8V2 P15254
P36683 P15254
P09831 P0AFG8
So in a Series, every object is combined with every other exactly once. The order doesn´t matter. Then the next Series starts right away.
Is there a easy way to do this?
UPDATE:
The Strings are in the index of a DataFrame. I access them with df.index.values. The DataFrames are in df_list.
def Cluster_Network(df_list):
combi_list = []
for cluster in df_list:
combi_list.append(tuple(itertools.combinations(cluster.index.values, 2)))
return combi_list
I get a list of tuples with the pairs in it.
[('P77717', 'P10378'),
('P18393', 'P77444'),
('P18393', 'P0AD44'),
('P18393', 'P10378'),
('P77444', 'P0AD44'),
('P77444', 'P10378'),
('P0AD44', 'P10378')),
(('P77562', 'P41039'),)]
How can I write the textfile out of that list?