Q. Write a program to create two dataframes with the following data:
df1
| Emp_code | Name |
|---|---|
| 110 | Taksh |
| 112 | Jeet Arora |
| 114 | Shubham Jain |
df2
| Emp_code | Name | Salary |
|---|---|---|
| 110 | Taksh | 45000 |
| 112 | Jeet Arora | 56000 |
| 114 | Shubham Jain | 55000 |
Store these two dataframes as two separate table files inside the same database.
Answer :-
import pandas as pd
emp_code = [110, 112, 114]
name = ['taksh', 'jeet', 'shubham']
salary = [45000, 56000, 55000]
df1 = pd.DataFrame({'emp_code': emp_code, 'name': name})
df2 = pd.DataFrame({'emp_code': emp_code, 'name': name, 'salary': salary})
You can convert data farm to table in given link :-
https://www.pathwalla.com/2021/04/the-dataframe-sdf-stores-sales-records.html
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )