Created
January 25, 2020 20:43
-
-
Save Hirosaji/7636384074d95f3e9068b6e169d69f6a to your computer and use it in GitHub Desktop.
handle tsv data (ex. delete column)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import numpy as np | |
with open('test.tsv', mode='r', newline='', encoding='utf-8') as f: | |
raw_input = csv.reader(f, delimiter='\t') | |
input = [row for row in raw_input] | |
# handle data (ex. delete column) | |
output = np.delete(input, 1, 1) | |
with open('output.tsv', mode='w', newline='', encoding='utf-8') as fo: | |
tsv_writer = csv.writer(fo, delimiter='\t') | |
tsv_writer.writerows(output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment