# Ignore consecutive whitespaces with CSV.read(...)

**URL:** <https://discourse.julialang.org/t/ignore-consecutive-whitespaces-with-csv-read/11304>\
**Category:** Data\
**Tags:** question\
**Created:** [May 31, 2018, 7:33pm UTC](https://discourse.julialang.org/t/ignore-consecutive-whitespaces-with-csv-read/11304 "2018-05-31T19:33:07Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [May 31, 2018, 8:19pm UTC](https://discourse.julialang.org/t/ignore-consecutive-whitespaces-with-csv-read/11304/7 "2018-05-31T20:19:35Z")

</div>

If that’s indeed a fixed-width file, see:

> [@Is there no standard way to read files with fixed width columns in the new DataFrames ecosystem?](https://discourse.julialang.org/t/is-there-no-standard-way-to-read-files-with-fixed-width-columns-in-the-new-dataframes-ecosystem/7324):
>
> I’ve been using DataFrames.readtable() to read files with fixed width columns, but that function is now deprecated in favor of CSV.read(). However it seems that CSV.read() lacks the flag to “treat consecutive whitespace delimiters as one” that would be required to make it handle fixed width data. Here’s a [sample file](http://www.pik-potsdam.de/~mmalte/rcps/data/RCP3PD_MIDYEAR_CONCENTRATIONS.DAT) from climate science (standardized scenarios of greenhouse gas concentrations called “Representative Concentration Pathways”). [More similar files available here](http://www.pik-potsdam.de/~mmalte/rcps/index.htm). DataFrames.readtab…

> [@Reading Fixed-Width Column Data](https://discourse.julialang.org/t/reading-fixed-width-column-data/4020):
>
> Hi All, I’m trying to read in a file with rows that look like 13 MEXICO 130971 14 INDONESIA 126582 15 UNITED KINGDOM 114486 Note the possible presence of spaces in the 2nd column. I haven’t been able to find any tool that will easily do this for me (saw [this](https://github.com/JuliaLang/julia/issues/5391), but the suggestion there doesn’t work here). Does one exist that I’m not finding, or do I hav…

---

_[View the full topic](https://discourse.julialang.org/t/ignore-consecutive-whitespaces-with-csv-read/11304)._
