1

I haven't been able to find much on this topic, so I would really like some help with the actual code to achieve this task. Preferably, use Pandas for the data structure and Python for the language. Assume a list of first names(Sally, Mike, etc) is inputted and you want to query this list from a database of first and last names(Sally Smith, Mike Miller, etc). Based upon last names already given, we want to modify this text file to only include the first names that are present in the other database.

6
  • Can you be more specific as to your input? This sounds like a network programming task... Commented Jun 16, 2015 at 2:16
  • Can you please edit your question to include information regarding what your input looks like... I assume that you want to load a Pandas dataframe but then query that dataframe based on some sort of list. Please supply info... Commented Jun 16, 2015 at 2:17
  • explain in more, what you want exactly? Commented Jun 16, 2015 at 2:19
  • It sounds like the user wants to query based on keys and values Commented Jun 16, 2015 at 2:20
  • It sounds like the OP wants to basically filter out the list of first names so that he can toss any first names that are not present in the list of first and last names. Commented Jun 16, 2015 at 2:25

1 Answer 1

1

Without information about the type of DB you are using, I'm assuming it accepts SQL queries and you can connect from Python.

If those two conditions are satisfied, I would suggest trying Pandas' built-in query:

http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_sql.html

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.