import pandas as pd
rawDF = pd.read_csv('D:\Project\python\Grade\GradeDataRaw.csv',names=['GradeCol'])
filteredDF = rawDF[rawDF['GradeCol'].str.contains('EVCS:|BVCS:|LOW POINT STA')]
print(filteredDF)
filename = 'GradeOut.csv'
filteredDF.to_csv(filename,index=False, encoding='utf-8')
Output in CSV file is
GradeCol
EVCS: 210+080.907
BVCS: 210+080.907
LOW POINT STA =208+108.133\PLOW POINT ELEV = 66.849\PPVI STA = 209+126.315\PPVI ELEV = 66.762\PA.D = 1.413%\PK
LOW POINT STA =208+108.133\PLOW POINT ELEV = 66.849\PPVI STA = 209+126.000\PPVI ELEV = 66.762\PA.D = 1.413%\PK
Would like to have only "PPVI STA = 209+126.315" in data frame row where there is this string available, other rows with EVCS & BVCS to remain intact, numerical part can vary in every row. With the extract method getting NaN values in the rows where the is no match , that is not the intention.
"info \GPK HEK = 209+126.315\info ends here"- is it the whole string/row or just one column in the row?