Python Forum
Getting false even when data exists
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting false even when data exists
#1
I have a csv file in pandas Data Frame and while trying to check for existence of Customer Key, it gives me False even when the Customer key provided by user is valid and exists in the Data frame.
CustomerKey = input("enter the Customer Key: ")
if CustomerKey in df['Customer Key']:
        print('True')
else:
    print('False')
the csv file has [660 rows x 7 columns]
buran write May-17-2021, 04:37 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Reply


Messages In This Thread
Getting false even when data exists - by sriniyum - May-17-2021, 04:14 AM
RE: Getting false even when data exists - by csr - May-17-2021, 08:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  p]Why os.path.exists("abc/d") and os.path.exists("abc/D") treat same rajeev1729 1 2,166 May-27-2020, 08:34 AM
Last Post: DeaD_EyE
  difference between «1 in [2] == False» and «(1 in [2]) == False» fbaldit 2 2,239 Apr-20-2020, 05:39 PM
Last Post: fbaldit
  How to insert data if not exists in mysql? farah97 0 2,828 Dec-29-2019, 08:32 AM
Last Post: farah97

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020