module bookutils
BookUtils Module
This module provides utility functions to manage a library system, including book management, tracking the issue and return of books, and updating book statuses.
Modules :
csv : Python library for handling csv files
numpy : Python library for data analysis
pandas : Python library for data visualization
Functions :
append_dict_to_csv(file_path, my_dict) : Appends the dictionary my_dict as a new row into the file path.
get_books(file_path) : Reads all the rows from the file.
find_book(file_path, name) : Searches in the file by name.
update_book_status(file_path, name, status) : Updates the issued column of the name with the status.
function append_dict_to_csv
append_dict_to_csv(file_path, my_dict)
Appends the book details into the books.csv file
This method takes the book’s attributes and appends them to a CSV file, effectively adding the book to the library’s records.
Parameters:
file_path(str)
: File path of the CSV filemy_dict(dict)
: Dictionary containing details of book to be added
Returns: None
function get_books
get_books(file_path)
Gets the list of all books in the library
Parameters:
file_path(str)
: File path of the CSV file
Returns:
result(numpy.ndarray)
: A numpy array containing the details of all books
function find_book
find_book(file_path, name)
Find a book by its name
Parameters:
file_path(str)
: File path of the CSV file
Returns:
result(numpy.ndarray)
: A numpy array containing the details of the book found
function update_book_status
update_book_status(file_path, name, status)
Updates the issued status of the book based on the input
Parameters:
file_path(str)
: File path of the CSV filename(str)
: Name of the book to update the statusstatus(str)
: The status to update (“Yes” or “No”)
Returns: None
This file was automatically generated via lazydocs.