Computer Science, asked by prajwaltp91, 7 months ago

Write a python program to create a dataframe from an existing dataframe and add 5 new rows to the data frame created above.

Answers

Answered by CoderRishav
1

Answer:

import pandas as pd

import numpy as np

# we used pandas module and numpy module

data = {

"Name":[],

"Age":[]

}

# for example we have created 2 coloumn name Name and Age

df = pd.DataFrame(data)

# we have created an empty dataframe

s2 = pd.Series([Nan,Nan], index=['Name', 'Age'])

for i in range(5):

df = df.append(s2)

# It will append 5 empty row

print(df)

# The result

Similar questions