Q. Four dictionaries store the details of four employees-of-the-month as (empno, name). Write a program to create a dataframe from these.
Answer =
import pandas as pd import numpy as np d = {"name":'name',"empno":1} d1 = {"name":'name1',"empno":2} d2 = {"name":'name2',"empno":3} d3 = {"name":'name3',"empno":4} s = pd.DataFrame([d,d1,d2,d3]) print(s)
Output :-
name empno
0 name 1
1 name1 2
2 name2 3
3 name3 4
>>>
What ?????
ReplyDeleteIsme to dataframe batana tha why have u used pd.Series then ?
ReplyDeleteEk badi list ke ander 4 dictionary bhi toh dal sakte hai na
ReplyDeleteYes, But we are solving questions of pandas.
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )