0% found this document useful (0 votes)
7 views

Library Management System Removed[1]

The document outlines a library management system implemented in Python, utilizing pandas and matplotlib for data handling and visualization. It includes functionalities for managing members and books, such as adding, searching, deleting, and issuing books, along with user authentication and data visualization options. Additionally, it references various sources for the code and software used in the project.

Uploaded by

skp861359
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Library Management System Removed[1]

The document outlines a library management system implemented in Python, utilizing pandas and matplotlib for data handling and visualization. It includes functionalities for managing members and books, such as adding, searching, deleting, and issuing books, along with user authentication and data visualization options. Additionally, it references various sources for the code and software used in the project.

Uploaded by

skp861359
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Date:

INDEX

1  ACKNOWLEGDEMENT
2  CSV TABLES
3  SOURCE CODE
4  OUTPUTS
5  BIBLIOGRAPHY

ACKNOWLEDGEMENT
Books available in the library :

 Books issued by members:

•Members of the library:


Source Code :
import pandas as pd

import matplotlib as pyplot

from datetime import date

print("Welcome to ABC Library")

def addNewMember():

mid=int(input('Enter member id :'))

m_name=input('Enter member name :')

phoneno=int(input('Enter phone number :'))

noofbooksissued=0

mdf=pd.read_csv('C\\LIBRARY\\excelfiles\\member.csv')

n=mdf['mid'].count()

mdf.at[n]=[mid,mname,phone,noofbooksissued]

mdf.to_csv('C\\LIBRARY\\excel files\\member.csv,'index=False)

print('New member added')

print(mdf)

def searchMember():

m_name=input('Enter member name:')

bdf=pd.read_csv('C:\\LIBRARY\\excelfiles\\member.csv')

df=bdf.loc[bdf['mname']--mname]

if df.empty:

print('No member found with this name')

else:

print('Members details:')
print(df)

def deleteMember():

mid = float(input('Enter member id :'))

bdf=pd.read_csv('C\\LIBRARY\\excelfiles\\members.csv')

bdf=bdf.drop(bdf[bdf['mid']==mid].index)

bdf.to_csv('C:\\LIBRARY\\excel files\\member.csv',index=False)

print('Member deleted')

print(bdf)

def showMembers():

bdf=pd.read_csv('C:\\LIBRARY\\excelfiles\\member.csv')

print(bdf)

def addNewBook():

bookid=int(input('Enter a bok id:'))

title=input('Enter book title:')

author=input('Enter author of the book:')

publisher=input('Enter book publisher:')

edition=input('Enter edition of the book:')

cost=input('Enter cost of the book:')

category=input('Enter category of the book:')

bdf=pd.read_csv("C:\\LIBRARY\\excelfiles\\book.csv")

n=bdf['bookid'].count()

bdf.at[n]=[bokid,title,author,publisher,editor,cost,category]

bdf.to_csv(r"C:\\LIBRARY\\excelfiles\\book.csv",index=False)
print('Book added successfully')

print(bdf)

def searchBook():

title=input('Enter a book name : ')

bdf=pd.read_csv('C:\\LIBRARY\\excelfiles\\book.csv')

df=bdf.loc[bdf['title']==title]

if df.empty:

print('no book found with this code')

else:

print('Book details:')

print(df)

def deleteBook():

bookid=float(input('Enter book id :'))

bdf=pd.read_csv(r'C:\\LIBRARY\\excel files\\book.csv')

bdf=bdf.drop(bdf[bdf['bookid']--bookid].index)

bdf.to_csv('C:\\LIBRARY\\excelfiles\\book.csv',index=False)

print("Book deleted")

print(bdf)

def showBooks():

bdf=pd.read_csv('C:\\LIBRARY\\excelfiles\\book.csv')

print(bdf)

def issueBooks():
book_name=input('Enter book name:')

bdf=pd.read_csv('C:\\LIBRARY\\excelfiles\\book.csv')

bdf=bdf.loc[bdf['title']==book_name]

if bdf.empty:

print('No book found in the library')

return

m_name=input('Enter member name :')

mdf=pd.raed_csv('C:\\LIBRARY\\excelfiles\\member.csv')

mdf=mdf.loc[mdf['m_name']==m_name]

if mdf.empty:

print('No such member found')

return

dateofissue=int(input('Enter date of issue :'))

noofbookissued=int(input('Enter number of book issued :'))

bdf=pd.read_csv('C:\\LIBRARY\\excelfiles\\issuebooks.csv')

n=bdf['book_name'].count()

bdf.at[n]=[book_name,m_name,date.today(),noofbookissued,'']

bdf.to_csv('C:\\LIBRARY\\excelfiles\\issuebooks.csv',index=False)

print('Books issued successfully')

print(bdf)

def returnBook():

m_name=input('Enter member name :')


book_name=input('Enter book name :')

idf=pd.read_csv('C:\\LIBRARY\\excelfiles\\issuebooks.csv')

idf=idf.loc[idf['book_name']==book_name]

if idf.empty:

print('The book is not issued in the records')

else:

idf=idf.loc[idf['m_name']==m_name]

if idf.empty:

print('the book is not issued to the member')

else:

print('Book can be retured')

ans=input('are you sure you want to return the book?')

if ans.lower()=='yes':

idf=pd.read_csv('C\\LIBRARY\\exelfiles\\issuebooks.csv')

idf=idf.drop(idf[idf['book_name']==book_name].index)

idf.to_csv('C\\LIBRARY\\excelfiles\\issuebooks.csv',index=False)

print('Book Returned')

else:

print('Return operation cancelled')

def showissuedBooks():

idf=pd.read_csv('C:\\LIBRARY\\excelfiles\\issuebooks.csv')

print(idf)

def deleteissuedBooks():

book_name=input('enter a book name :')


bdf=pd.read_csv('C:\\LIBRARY\\excelfiles\\issuebooks.csv')

bdf=bdf.drop(bdf[bdf['book_name']==book_name].index)

bdf.to_csv('C:\\LIBRARY\\excelfiles\\issuebooks.csv',index=False)

print('Delated issued book successfully')

print(bdf)

def showCharts():

print('Press 1- Book and its cost')

print('Press 2- Number of books isssued by members')

ch=int(input('Enter your choice:'))

if ch==1:

df=pd.read_csv('C:\\LIBRARY\\excelfiles\\book.csv')

df=df[['title','cost']]

df.plot('title,'cost',kind='bar')

plt.xlabel('---title--- ')

plt.ylabel('---cost---')

plt.show()

if ch==2:

df=pd.read_csv('C:\\LIBRARY\\excelfiles\\issuebooks.csv')

df=df[['noofbooksissued','m_name']]

df.plot(kind='bar',color='red')

plt.show()

def login():
uname=input('Enter username :')

pwd=input('Enter password :')

df=pd.read_csv('C:\\LIBRARY\\excelfiles\\users.csv')

df=df.loc[df['username']==uname]

if df.empty:

print('Invalid username')

return False

else:

df=df.loc[df['password']==pwd]

if df.empty:

print('Invalid password')

return False

else:

print(':Username and password matched:')

return True

def showMenu():

print('Press 1-Add a new book')

print('Press 2-Search for a book')

print('Press 3-Delete a book')

print('Press 4-Show all books')

print('Press 5-Add a new member')

print('Press 6-Search for a member')

print('Press 7-Delete a book')

print('Press 8-Show all members')

print('Press 9-Isuue a book')


print('Press 10-Return a book')

print('Press 11-Show all isuued book')

print('Press 12-Delete an issued book')

print('Press 13-To view charts')

print('Press 14-To exit')

choice=int(input('Enter your choice: '))

return choice

if login():

while True:

ch=showMenu()

if ch==1:

addNewBook()

elif ch==2:

serchBook()

elif ch==3:

deleteBook()

elif ch==4:

showBooks()

elif ch==5:

addNewMember()

elif ch==6:

searchMember()

elif ch==7:

deleteMember()

elif ch==8:

showMembers()
elif ch==9:

issueBooks()

elif ch==10:

returnBook()

elif ch==11:

showissuedBooks()

elif ch==12:

deleteissuedBooks()

elif ch==13:

showCharts()

elif ch==14:

break

else:

print('Invalid Option')
 Outputs:
:To start the program press F5 key:

:To add new book details in the csv file:


:To search a book in the csv:

:To delete a book from csv:


:To add a new member:

:To search for a member in csv:


:To view graph chart:
BIBLIOGRAPY

Software used : Python(pandas and matplotlib library),


Microsoft Excel
References for source code:
Geeks for geeks
We3school
Python school
YouTube
Sumita Arora 12th std TextBook

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy