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