Questions tagged [isin]

isin is a concept of checking if some value is contained in a list; That concept is used in Python with [pandas] and [numpy]

isin is a concept of checking if some value is contained in a list; That concept is used in Python with [pandas] and [numpy]

147 questions
0
votes
1 answer

How can I assign columns from one data frame to another, when the ID is the same? Using isin() - Python

I am using python and pandas. I have: df1: df2: |index | ID | |index | ID | name | | 1 | 34 | | 1 | 35 | Astri | | 2 | 35 | | 2 | 36 | Carlos| | 3 | 36 | | 3 | 34 | Xim | So, i want somthing…
Mhul
  • 1
0
votes
2 answers

Is there a way to use pandas .isin() function with multiple lists?

classes money mask student 6 psp -26.23 adj|psp # keep 6 tnt 0.00 adj|psp 6 nvm -87.42 adj|psp 6 alw 0.00 adj|psp 6 tnt -14.87 adj|psp 6 adj 9.55 adj|psp # keep 6 psp -18.56 …
-1
votes
1 answer

Identifying if list of points exists in rectangle

I'm new to Python and trying to determine if a list of points is inside a rectangle. I think my issue might have to do with iterating on integers but I'm not sure how to resolve it. However, I tried the following solution for a list of points and…
-1
votes
1 answer

query() and isin() combination is not working in Kaggle notebook

I want to filter dataframe using .query() and .isin() functions in Kaggle notebook. standard_stats=standard_stats.query('`Unnamed: 0_level_0_Player`.isin(["Squad Total","Opponent Total"])==False') Unnamed: 0_level_0_Player is the name of the column…
beridzeg45
  • 246
  • 2
  • 11
-1
votes
1 answer

Add new column with number of occurences (.isin) in other column

How can I count how often each value in the column substring occurs in the column string and append the result as a new column given this example dataframe: df = pd.DataFrame({ 'substring':['a', 'b', 'c', 'a', 'b', 'c', 'd', 'd', 'a'] 'string':['a a…
hyhno01
  • 177
  • 8
-1
votes
3 answers

Add column if value is in another column of another dataframe

One of my dataframe is: name value 0 Harry a 1 Kenny b 2 Zoey h another is: list topic 0 Jame, Harry, Noah topic1 1 lee, zee topic2 I want if any of the names of…
Tanishka Bansal
  • 49
  • 1
  • 10
-1
votes
1 answer

iterate through column to match with dict values

I have a dict similar to this: dict = {'color':['red', 'blue', 'green'], 'fruits':['apple', 'banana', 'grape'], 'animal':['cat', 'dog']} and df with two columns; text column with multiple strings: index | text ------------------------------- a …
enka
  • 1
-1
votes
1 answer

Isin function skip correct value python

I am working with a response json file from a get API request. I have been able to figure out how to flatten the response and I want to filter the related dataframe by records containing pdf file extension only that I the will use to retrieve the…
Torakiki
  • 45
  • 6
-1
votes
1 answer

Add column containing list value if column contains string in list

I'm trying to scan a particular column in a dataframe, eg df['x'] for values which I have in a separate list list = ['y', 'z', 'a', 'b']. How do I make pandas load a new column with the list value if df['x'] contains any, or more than one of the…
KT6345
  • 33
  • 1
  • 8
-1
votes
2 answers

Check if multi index is in two dataframes

I have two dataframes with columns of state and regionname, and I'm trying to see if df2 is in df1, and add that column to df3 df1= +--------------+------------+------+ | State | RegionName | Data | +--------------+------------+------+ | New…
-3
votes
1 answer

Convert tIckers bloomberg into ISIN

I have a large list of bloomberg tickers for BE500 Index but I need the ISIN or CUSIPS... How can I get it? Thanks
-3
votes
3 answers

How to get words matches with it's count using pandas

i have 2 Dataframes like set1 = ['a','b','c','d','e','f','g','h','i','j'] set2 = ['a','b','b','c','c','f','h','j','k'] df1 = pd.DataFrame(set1, columns=['name']) df2 = pd.DataFrame(set2, columns=['name']) i want to compare these 2 Dataframes…
Vishal Vijayan
  • 57
  • 1
  • 2
  • 12
1 2 3
9
10