To create a dataframe in python, we first need to import the pandas library:
main.py20 chars2 lines
Then, we can create a dataframe using a dictionary, where keys represent column names and values represent the data for each column. For example:
main.py152 chars6 lines
This creates a dataframe with 3 columns (Name, Age, Gender) and 4 rows. We can print the dataframe using the following code:
main.py10 chars2 lines
This will output:
main.py120 chars6 lines
gistlibby LogSnag