python - removing items from current csv and saving it into another csv file -


i have csv file has 1000 entries (it delimitered tab). i've listed first few.

    unique id   name  0  60ff3ads    keith  1  c6lsi545    shawn  2  o87si523    baoru  3  om022ssi    naomi  4  3lls34si    alex  5  z7423dsi    blahblah 

i want remove of these entries index number csv file , save csv file.

i've not started writing codes yet because i'm not sure how should go doing it.. please kindly advise.

a one-liner solve problem:

import pandas pd  indexes_to_drop = [1, 7, ...] pd.read_csv('original_file.csv', sep='\t').drop(indexes_to_drop, axis=0).to_csv('new_file.csv') 

check read_csv doc accommodate particular csv flavor if needed


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -