-4

Remove the values in column titled “LogKOW” corresponding to the values starting with V-Mey_NA in the column titled “CAS”.

  • 2
    Welcome to StackOverflow. Please take the time to read this post on [how to provide a great pandas example](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) as well as how to provide a [minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) and revise your question accordingly. These tips on how to ask a good question may also be useful. – yatu Apr 30 '20 at 17:53
  • Please provide some sample data. – Sajan Apr 30 '20 at 18:04
  • https://archive.ics.uci.edu/ml/machine-learning-databases/00511/ – Prabal Bali Apr 30 '20 at 18:36

3 Answers3

0

I guess this will work

for index in df.index:
    if(df['CAS'][index].find('V-Mey_NA') != -1):
        df['LogKOW'][index] = np.nan
0

This might help in removing the values

x = df1["CAS"].str.startswith("V-Mey_NA")
n = np.arange(0,1058,1)
df1.drop(n[x])
David Buck
  • 3,752
  • 35
  • 31
  • 35
0

Try this instead

import numpy as np
df['LogKOW'] = np.where(df.CAS.str.startswith('V-Mey_NA'),np.NaN,df['LogKOW'])