将列表与另一个没有循环的列表python合并

ira*_*v94 1 string merge join python-3.x pandas

我有2个熊猫系列,看起来像这样:

import pandas as pd
listA = [5,4,3]
listB = ["a","b","c"]
s = pd.Series(listA)
print(s)
p = pd.Series(listB)
print(p)
Run Code Online (Sandbox Code Playgroud)

我想获得一个混合在一起的2个列表的列表,如下所示:

listTogether = ["a5","a4","a3","b5","b4","b3","c5","c4","c3"]
t = pd.Series(listTogether)
print(t)
Run Code Online (Sandbox Code Playgroud)

你有什么提示吗?是否可以避免循环?

非常感谢您的帮助

WeN*_*Ben 5

一招 MultiIndex

listTogether = pd.MultiIndex.from_product([p,s.astype(str)]).map(''.join).tolist()
listTogether 
Out[242]: ['a5', 'a4', 'a3', 'b5', 'b4', 'b3', 'c5', 'c4', 'c3']
Run Code Online (Sandbox Code Playgroud)