<p>从网上看,有几个选择:</p>
<ul>
<li><a href="https://gist.github.com/ryanhill29/f90b1c68f60d12baea81" rel="nofollow">https://gist.github.com/ryanhill29/f90b1c68f60d12baea81</a></li>
<li><a href="http://pandaproject.net/docs/importing-dbf-files.html" rel="nofollow">http://pandaproject.net/docs/importing-dbf-files.html</a></li>
<li><a href="https://geodacenter.asu.edu/blog/2012/01/17/dbf-files-and-p" rel="nofollow">https://geodacenter.asu.edu/blog/2012/01/17/dbf-files-and-p</a></li>
<li><a href="https://pypi.python.org/pypi/simpledbf" rel="nofollow">https://pypi.python.org/pypi/simpledbf</a></li>
</ul>
<hr/>
<p>使用<a href="https://pypi.python.org/pypi/simpledbf" rel="nofollow">simpledbf</a>:</p>
<pre><code>dbf = Dbf5('fake_file_name.dbf')
df = dbf.to_dataframe()
</code></pre>
<hr/>
<p>根据要点调整:</p>
<pre><code>import pysal as ps
def dbf2DF(dbfile, upper=True):
"Read dbf file and return pandas DataFrame"
with ps.open(dbfile) as db: # I suspect just using open will work too
df = pd.DataFrame({col: db.by_col(col) for col in db.header})
if upper == True:
df.columns = map(str.upper, db.header)
return df
</code></pre>