How to limit columns while creating df from list of tuples?
Expected Input:
data = [('a',11,111),
        ('b',22,222),
        ('c',33,333)]
Expected Output:
   A   B
0  a  11
1  b  22
2  c  33
I wrote:
pd.DataFrame([(x[0], x[1]) for x in data], columns=['A', 'B'])
BUT is there any more elegant way to do this?
I think we can do from_records
pd.DataFrame.from_records(data,exclude=[2], columns=['A','B',2])
Out[27]: 
   A   B
0  a  11
1  b  22
2  c  33
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With