import pandas as pd
import numpy as np
import [Link] as plt
df = pd.read_csv("C:\\Users\\nithesh anand\\Downloads\\IP\\Import and Export -[Link]")
print('Welcome to the world of Import and Export')
pro = True
while pro:
print("Menu")
print("[Link] data")
print("[Link] Graph")
print("[Link] chart")
print("[Link] trade deficit")
print("[Link]")
choice = int(input("Enter your choice: "))
if choice == 1:
submenu=True
while submenu:
print("Sub-Menu")
print("1. Read CSV")
print("2. Update CSV")
print("3. Return back to main menu")
inchoice = int(input("Enter your choice: "))
if inchoice == 1:
print(df.to_string(index=False))
elif inchoice == 2:
updmenu = True
print("1. Add a row")
print("2. Delete a row")
print("3. Return to main menu")
inchoice2 = int(input("Enter your choice: "))
if inchoice2 == 1:
hsn = int(input("HSN Code: "))
commodity = input("Commodity: ")
impcount = input("Imported Country: ")
expcount = input("Exported Country: ")
imp23 = int(input("Imports in 2023: "))
exp23 = int(input("Exports in 2023: "))
imp24 = int(input("Imports in 2024: "))
exp24 = int(input("Exports in 2024: "))
x=[hsn, commodity,impcount,expcount, imp23,exp23,imp24, exp24]
[Link][10]=x
print("The new record has been added.")
print(df.to_string(index=False))
elif inchoice2 == 2:
idx = int(input("Enter row index to delete: "))
df = [Link](index=idx)
print("Row deleted successfully.")
print(df.to_string(index=False))
elif inchoice2 ==3:
updmenu=False
submenu=False
else:
print("Invalid choice!")
elif inchoice == 3:
submenu=False
elif choice==2:
barmenu=True
while barmenu:
print("Bar chart menu")
print('[Link]')
print('[Link]')
print('[Link] to main menu')
bmenu=int(input('Enter your choice:'))
if bmenu == 1:
products=[Link]
x=[Link](len(products))
imp23=[Link][:,4]
imp24=[Link][:,6]
[Link](products,imp23,color='r',label='2023 Imports',width=0.25)
[Link](x+0.25,imp24,color='b',label='2024 Imports',width=0.25)
[Link](x + 0.125, products, rotation=45)
[Link]('commodities')
[Link]('Values in US $')
[Link]('Imorts of 2023 and 2024')
plt.tight_layout()
[Link]()
[Link]()
elif bmenu == 2:
products=[Link]
exp23=[Link][:,5]
exp24=[Link][:,7]
[Link](x, exp23, color='r', width=0.25, label='2023 Exports')
[Link](x + 0.25, exp24, color='b', width=0.25, label='2024 Exports')
[Link](x + 0.125, products, rotation=45)
[Link]('Commodities')
[Link]('Values in US $')
[Link]('Exorts of 2023 and 2024')
[Link]()
plt.tight_layout()
[Link]()
elif bmenu== 3:
barmenu=False
else:
print('Enter right choice')
elif choice==3:
linemenu=True
while linemenu:
print("Line chart menu")
print('1.2023')
print('2.2024')
print('[Link] to main menu')
lmenu=int(input('Enter your choice:'))
if lmenu == 1:
products=[Link]
x=[Link](len(products))
imp23=[Link][:,4]
exp23=[Link][:,5]
[Link](products,imp23, marker='d',color='y',label='2023 Imports')
[Link](products,exp23, marker='d',color='g',label='2024 Imports')
[Link]('commodities')
[Link]('Values in US $')
[Link]('Exports and Imports of 2023')
[Link](x + 0.125, products, rotation=45)
plt.tight_layout()
[Link]()
[Link]()
elif lmenu == 2:
products=[Link]
x=[Link](len(products))
imp24=[Link][:,6]
exp24=[Link][:,7]
[Link](products,imp24, marker='o',color='y',label='2023 Exports')
[Link](products,exp24, marker='o',color='g',label='2024 Exports')
[Link]('commodities')
[Link]('Values in US $')
[Link]('Exports and Imports of 2023')
[Link](x + 0.125, products, rotation=45)
plt.tight_layout()
[Link]()
[Link]()
[Link]()
elif lmenu== 3:
linemenu=False
else:
print('Enter right choice')
elif choice ==4:
td23=[Link][:,5]-[Link][:,4]
td24=[Link][:,7]-[Link][:,6]
comm=[Link][:,1]
td=[Link]({'2023':[Link],'2024':[Link]},index=[Link])
print(td)
elif choice == 5:
print('Hope you liked our Project')
print('Thank you!')
pro=False