1
21/11/2022 7:18 pm
Topic starter
Write a Python code to create a dataframe with headings ( a and b ) from the list given below :
[ [ 1,2 ],[ 3,4 ],[ 5,6 ],[ 7,8 ] ]
1 Answer
1
27/11/2022 12:40 pm
Topic starter
Code:
import pandas as pd data = [[ 1,2 ],[ 3,4 ],[ 5,6 ],[ 7,8 ] ] df = pd.DataFrame(data, columns=["a","b"]) print(df)
Output:
a b 0 1 2 1 3 4 2 5 6 3 7 8