4

I am trying to convert a .dbf file to a pandas.DataFrame. However, I am getting an error from the following line of code:

dbf = ps.open(dbf_link)

File "/Users/UserName/anaconda/lib/python2.7/site-packages/pysal/core/IOHandlers/pyDbfIO.py", line 77, in init assert terminator == '\r' AssertionError

Heres my code:

import pysal as ps
import pandas as pd

dbf_link = '//Users/UserName/pyProjects/I_cst.Dbf'
dbf = ps.open(dbf_link)
d = {col: dbf.by_col(col) for col in dbf.header}
df = pd.DataFrame(d)
jGaboardi
  • 124
  • 2
  • 9
Mantis
  • 1,357
  • 3
  • 27
  • 49
  • Sounds like your DBF is corrupt, or there's a bug in the PySAL dbf reader. You can try running python with the -O flag which will disable assert statements. Can you verify the bug with another DBF? – Charles Sep 08 '15 at 19:07

0 Answers0