Answers for "python how to make a dataframe"

25

dataframe create

>>> df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
...                    columns=['a', 'b', 'c'])
>>> df2
   a  b  c
0  1  2  3
1  4  5  6
2  7  8  9
Posted by: Guest on May-14-2020
0

Different ways to create Pandas Dataframe

# Import pandas library
import pandas as pd
 
# initialize list of lists
data = [['tom', 10], ['nick', 15], ['juli', 14]]
 
# Create the pandas DataFrame
df = pd.DataFrame(data, columns = ['Name', 'Age'])
 
# print dataframe.
df
Posted by: Guest on August-11-2021

Code answers related to "python how to make a dataframe"

Python Answers by Framework

Browse Popular Code Answers by Language