Avatar ·

Remove the lines in Dataframe satisfying the condition

📁 python, pandas, jupyter

How to remove the lines in Pandas Dataframe, in which the values ​​in the column stp == 1005092

Details:

I am engaged in data processing in jupyter Notebook : normal distribution, spectrograms, histograms, etc. I have 1,500 thousand indexed arrays inside one file (index '' STP ''). There are 2 arrays that are not suitable according to the indications (clearly stand out from the remaining 1498 values), but undergo a normal distribution test, which is why they are not filtered by the program. I tried the commands data.Stp.remove (1005072) , where a seven -digit number is an array index, but everything is in vain.

code:

  Cols = [ 'ttt' ,  'ik05' ,  'ik06' ,  'ik07' ,  'ik08' ,  'ik10' , ,  'ik14' ,  'ik16' ,  'ik20' , ,  'DA06' ,  'DA07' ,  'DA08' , ,  'DA11' ,  'DA14' ,  'da16' , ,   'gz1' ,  'gz2' ,  'gz3' ,  'gz4' ,  '' ''" "" "" ""  'lld' ,  'stp' ]   def   lasread  (fname):  data pd.read_table (fname, deelim_whitespace =  true , na_values ​​=  '-999.25' , index_col =  false )   retu  data [cols] data =  none    for  name  in  laas:   print  (name)   if  data  no : : : :  Data = lasread (name)   else :  data = pd.concat ([data, lasread (name)]) ndata = data.asas_matrix (columns =  none ) df = data [cols] df1 = df. grampby ( 'stp' ) df1.head () dfp = pd.dataframe ()   for  name, group  in  df1:  k, p = stats.mstats.normaltest (group [span class = ""> 5 :  5 ])  dfp [name] = pd = dfp.transpose () d.columns = colsgoodindex = d [D.ik20 & gt;  0.05 ] [D.da20 & gt;  0.05 ]. Index - rejection by foster ** Data.Stp.remove ( 1005072 ) ** filteDData = Data [cols] [Data.stp == - 39 ]   for  f  in  goodindex:  a = data.stp == F]        FILThedDATA = PD.Concat ([FILThedData, A])   print  (filledData)