Q. WAP to read details such as item, sales made in a dataframe and then store this data in a CSV file.


Answer :-


import pandas as pd
d = {'Fridge': [12], 'Cooker': [5], 'Juicer': [15], 'Iron': [11]}
df = pd. DataFrame (d)
print (df)
df.to_csv ("file.csv")


Output :-

   Fridge  Cooker  Juicer  Iron
0      12       5      15    11

>>>

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post