举个例子
ntest=['a','b'] ltest=[[1,2],[4,5,6]]
最后我想得到下面这种结果:a 1a 2b 4b 5b 6这种该怎么做呢?
# coding: utf-8 import pandas as pd ntest = ['a','b'] ltest = [[1,2], [4,5,6]] data = [(k, v) for k, l in zip(ntest, ltest) for v in l] print pd.DataFrame(data)
2.1m questions
2.1m answers
60 comments
56.8k users