Create new database from chunk reader in pandas
<p>I'm working with a massive excel file (14GB) that I need to clean so only the information I need is left. I made the file into Chunks so my computer would stop crashing, but now need to create a new database that shows only the data for the city I am looking for. </p>

<p>I have made it to print(chunk)</p>

<pre><code>for chunk in reader:
    print(chunk)
</code></pre>

<p>am unsure how to continue, I tried</p>

<pre><code>df = reader
df = reader[reader.SitusCity == Miami]
</code></pre>

<p>But get this error code:</p>

<pre><code>---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
&lt;ipython-input-7-d4c11720d1c5&gt; in &lt;module&gt;()
----&gt; 1 df = reader[reader.SitusCity == Miami]

AttributeError: 'TextFileReader' object has no attribute 'SitusCity'
</code></pre>

<p>Help!!!</p>

<p>try this:</p>

<pre><code>chunk in reader:
    chunk.ix[chunk.SitusCity == 'Miami'].to_excel('output.xlsx', mode='a')
</code></pre>

python excel pandas jupyter jupyter-notebook