3

I have a tab separated file which looks like this:

time_point  COL1A1  COL1A2  ACTA2   MMP1    TGFb_indep
120.5   2.4368708456    2.7397795032    0.1363219507    0.0864637842    0
121 1.8424199632    2.5120095489    0.1298143655    0.0912919808    0
122 1.9638241905    2.6892349035    0.1067387391    0.0691376693    0
123 2.3264487357    3.0663649168    0.1487167855    0.0906078211    0
124 1.9111306243    3.1013070916    0.1334430791    0.0758170634    0
128 2.178030898 3.446027992 0.1279528707    0.0817450068    0
132 2.0877010754    3.2035358965    0.1212986296    0.0467952257    0
144 2.5405821891    3.2318699308    0.1660787202    0.0232173824    0
168 3.8196607541    4.4386301784    0.2278481418    0.0096855824    0
192 5.6809072904    5.4057371332    0.316546941 0.0030576762    0
216 6.2100964486    4.5358900665    0.2751968144    0.0109808662    0

120.5   1.8871528102    3.0664538707    0.1385118438    0.1116450543    0
121 1.7263163381    2.2211192542    0.1046306079    0.1017511394    0
122 1.3954984869    1.9406642741    0.0724319768    0.0869048534    0
123 1.7788798036    2.4797402932    0.1240582026    0.1087456075    0
124 1.7990099619    3.0991297898    0.1021409421    0.0874712776    0
128 1.3340691151    2.7177324043    0.121746602 0.0662573086    0
132 2.0310867907    3.2725197272    0.128716766 0.0439254808    0
144 1.6466766027    2.996082284 0.1392247152    0.0214132449    0
168 3.1344690032    3.4941972773    0.18797218  0.0036672925    0
192 5.6042994743    4.7215614619    0.2671004016    0.0057764708    0
216 6.5017267162    5.0517838682    0.2733029462    0.0055187717    0

120.5   1.3639060927    1.9018906704    0.0844806249    0.1057254287    0
121 1.4016527716    1.8399531066    0.0822288805    0.1211653422    0
122 1.572553287 2.2747671958    0.1189649844    0.1036497761    0
123 1.5284764041    1.7291994479    0.0966641189    0.0962255806    0
124 1.2868781898    2.0602872579    0.0929910385    0.0695230652    0
128 1.5388150552    2.3812182386    0.1074531625    0.0640201492    0
132 1.122722224 1.9258308992    0.083826548 0.0544045465    0
144 1.8468717406    2.5963838351    0.1276480744    0.0296577648    0
168 2.797855876 2.8019702692    0.2160177321    0.0097123198    0
192 4.395782804 3.8935876519    0.2666483128    0.0027911978    0
216 5.8888387226    4.5645833006    0.2298800484    0.0148278492    0

The white spaces are meaningful and need to be retained. How can I read this into a pandas dataframe?

pandas.read_csv('data_file.csv', sep'\t') 

Automatically removes the lines with only spaces.

1 Answer 1

8

Pass the skip_blank_lines=False argument to read_csv -

pandas.read_csv('data_file.csv', sep'\t', skip_blank_lines=False)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.