0

We use

fund_data.loc[fund_data['SubVertical']=="Data Analytics platform"]

to display all details of the columns containing these('Data Analytics platform') strings in the condition of a column in pandas, but suppose we want to display rows containing even some part of the string like all rows having the word 'Data' in the 'SubVertical' column.

fund_data.loc[fund_data['SubVertical']=="%Data%"] #or something like this

should return the following

  c1 c2
1 A  Data Analysis
2 B  Data Analytics
3 C  Big  Data
4 D  Consumer Data platfrom
5 E  Data platforms
etc.... 
noswear
  • 305
  • 1
  • 3
  • 20
  • `fund_data.loc[fund_data['SubVertical'].str.contains('Data')]` – jezrael Apr 22 '18 at 06:51
  • the code gave the following error `cannot index with vector containing NA / NaN values` but this did the job `fund_data.loc[fund_data['SubVertical'].str.contains('Data')==True]` – noswear Apr 22 '18 at 06:57
  • `fund_data.loc[fund_data['SubVertical'].str.contains('Data', na=False)]` – jezrael Apr 22 '18 at 06:59

0 Answers0