pandas-dev / pandas

Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
https://pandas.pydata.org
BSD 3-Clause "New" or "Revised" License
43.77k stars 17.97k forks source link

The query returns Empty array when i use Where in query string #16636

Closed mushtaque87 closed 7 years ago

mushtaque87 commented 7 years ago

Code Sample, a copy-pastable example if possible

# Your code here
aadhaar_data = pd.read_csv('/Users/philips/Downloads/aadhaar_data.csv')
aadhaar_data.rename(columns = lambda x: x.replace(' ', '_').lower(), inplace=True) #rename column
  query = "SELECT pin_code from aadhaar_data where state = 'Gujarat' "
    aadhar_queried_data = sqldf(query.lower(), locals())
    print(aadhar_queried_data)

Problem description

When i user normal query it returns a dataframe , But when i put an condition in a query like Where it returns an empty array

Empty DataFrame Columns: [pin_code] Index: []

Data set # https://s3.amazonaws.com/content.udacity-data.com/courses/ud359/aadhaar_data.csv

Expected Output

Output of pd.show_versions()

# Paste the output here pd.show_versions() here
jorisvandenbossche commented 7 years ago

This seems like a sqldf issue, can you report it over there? I think https://github.com/yhat/pandasql/