Answer to Question #275470 in Python for Rushikesh

Question #275470

Discuss different ways of creating a dataframe in python programming



languages using panda library. Justify your answer with the help of



suitable example.

1
Expert's answer
2021-12-04T12:12:49-0500
# 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. 








dict_a = {
   'col_a': np.random.randint(100, size=500),
   'col_b': np.random.random(500),
   'col_c': np.random.randn(500)
}
df = pd.DataFrame(dict_a)
print(df.shape)
(500, 3)
df.head()

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS