How to delete column from .csv file without reading the whole file
<p>I generate very big .csv file but now it doesn't fit the RAM. So i decided to delete some inefficient columns to reduce the file size. How can I do that? </p>

<p>I tried data = <code>pd.read_csv("file.csv", index_col=0, usecols=["id", "wall"])</code> but it still doesn't fit the RAM.</p>

<p>File is about 1.5GB, RAM is 8GB. </p>

<p>I am not sure if this is possible in pandas. You can try to do it in the Command Line. On Linux it will look like: </p>

<pre><code>cut -f1,2,5- inputfile
</code></pre>

<p>if you want to delete columns with indexes 3 and 4.</p>

python csv pandas