If you look at the data below, I want to include the #CHROM line so that the data below can come out in Excel format, but it keeps coming out in one line... Is there any way? Desired result is below
Change the picture above to the way below.
It's very easy, but I don't know because I'm a beginner. Help me...
I'll post what I planned just in case you need it.
f = open("test.vcf", 'r')
fw= open("result.txt", 'w')
file_a = f.readlines()
for i in file_a:
part = file_a[280:]
part1= str(part)
part2= part1.split("\\")
print part2
print >> fw,part2
break
f.close()
fw.close()
If you are a csv file with a description in the front of the file, you can read the data by skipping the annotation part, not the data, by giving the skiprows
option, while reading it as a read_csv
function in pandas
.
© 2024 OneMinuteCode. All rights reserved.