<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Pandas on Vedant Andhale</title>
    <link>https://www.vedant.me/tags/pandas/</link>
    <description>Recent content in Pandas on Vedant Andhale</description>
    <image>
      <url>https://www.vedant.me/</url>
      <link>https://www.vedant.me/</link>
    </image>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Thu, 10 Sep 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.vedant.me/tags/pandas/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>loadfile: one call to load tabular data</title>
      <link>https://www.vedant.me/projects/loadfile/</link>
      <pubDate>Thu, 10 Sep 2026 00:00:00 +0000</pubDate>
      
      <guid>https://www.vedant.me/projects/loadfile/</guid>
      <description>A small Python package that loads local and cloud files into pandas through a consistent API, replacing repeated file-loading code.</description>
      <content:encoded><![CDATA[<p>I built <strong>loadfile</strong> to stop copying the same file-loading code between scripts. It provides one entry point for tabular data, whether the file is on local disk or in cloud storage.</p>
<h2 id="one-small-api">One small API</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">loadfile</span> <span class="kn">import</span> <span class="n">load</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">df</span> <span class="o">=</span> <span class="n">load</span><span class="p">(</span><span class="s2">&#34;data/local.csv&#34;</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">df</span> <span class="o">=</span> <span class="n">load</span><span class="p">(</span><span class="s2">&#34;gs://my-bucket/data.parquet&#34;</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">df</span> <span class="o">=</span> <span class="n">load</span><span class="p">(</span><span class="s2">&#34;archive.zip&#34;</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="s2">&#34;sales.csv&#34;</span><span class="p">)</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>The function is named <code>load()</code>. The package also exports <code>load_data()</code> as a backwards-compatible alias.</p>
<p><code>fsspec</code> selects the storage backend from the path prefix. The package selects the reader from the file extension, or an explicit <code>format=</code> argument, and passes reader options through to pandas. Cloud backends require their corresponding optional dependencies and credentials.</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">df</span> <span class="o">=</span> <span class="n">load</span><span class="p">(</span><span class="s2">&#34;export.tsv&#34;</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="s2">&#34;csv&#34;</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">&#34;</span><span class="se">\t</span><span class="s2">&#34;</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">df</span> <span class="o">=</span> <span class="n">load</span><span class="p">(</span><span class="s2">&#34;large.csv&#34;</span><span class="p">,</span> <span class="n">fast</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">usecols</span><span class="o">=</span><span class="p">[</span><span class="s2">&#34;id&#34;</span><span class="p">,</span> <span class="s2">&#34;value&#34;</span><span class="p">])</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>CSV, Parquet, JSON, Excel and Feather share the same interface. <code>fast=True</code> opts into Arrow-backed reading; it changes the reading defaults rather than promising a fixed speedup for every file.</p>
<h2 id="zip-files-without-another-helper">ZIP files without another helper</h2>
<p>A ZIP containing one supported data file returns a DataFrame. Multiple supported members return a dictionary keyed by filename. You can select one member by name or pass a list to load a subset.</p>
<p>The implementation reads ZIP contents into memory, so archive size still matters. The aim is a convenient reusable loader, not an out-of-core processing engine.</p>
<p>Source: <a href="https://github.com/VedantAndhale/loadfile/blob/main/src/loadfile/__init__.py">public API</a> and <a href="https://github.com/VedantAndhale/loadfile/blob/main/src/loadfile/core.py">loading implementation</a>.</p>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
