shahilsaha
Aug 21st, 2024
6
0
Never
This is comment for paste py_bookingApp
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. The error was that it was getting the id data as int and I was trying to pass in a string:
  2.  
  3. Error:
  4.  
  5. Traceback (most recent call last):
  6. File "E:\PythonProjects\py_apps\py_hotelBooking\main.py", line 35, in <module>
  7. hotel.isAvailable()
  8. File "E:\PythonProjects\py_apps\py_hotelBooking\main.py", line 20, in isAvailable
  9. if available == "yes":
  10. ^^^^^^^^^^^^^^^^^^
  11. File "E:\PythonProjects\py_apps\py_hotelBooking\.venv\Lib\site-packages\pandas\core\generic.py", line 1577, in __nonzero__
  12. raise ValueError(
  13. ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
  14.  
  15. Fix:
  16.  
  17. add the "dtype=str" to the parameter so that it reads everything as string
  18. df = pd.read_csv("assets/hotels.csv", dtype=str)
  19.  
Advertisement
Add Comment
Please, Sign In to add comment