Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Issue with Data File Import in Biogeme

18 views
Skip to first unread message

Inbal Glickman

unread,
Oct 14, 2024, 3:16:32 AM10/14/24
to Biogeme

Dear Professor  Bierlaire,

 I frequently use the biogeme, but this time, I am unable to read my data file correctly. It appears that Biogeme is treating the entire file as a single unit, failing to separate the columns appropriately. Additionally, it is not recognizing the header row as a separate line but rather as part of the data due to identifying the data type as an object.

I would appreciate any guidance you could provide on how to resolve this issue. If possible, I can upload the data file for your review.

Thank you for your assistance.

Best regards,

Inbal Glickman

my code:

andas = pd.read_csv("Data for modeling.dat", sep='\t')
database = db.Database("/Data for modeling.dat",pandas)

globals().update(pandas.variables)

Michel Bierlaire

unread,
Oct 14, 2024, 3:54:00 AM10/14/24
to inba...@gmail.com, Michel Bierlaire, Biogeme
This seems to be a Pandas issue, not a Biogeme issue.

Check the data after it has been read:
my_data = pd.pread_csv('my_file.dat', sep='\t')
Note that the sep='\t' means that the columns are separated by tabs.

Then, investigate if it has been correctly read:
print(my_data)
print(my_data.describe())

Also, I strongly advise not to use "globals().update(pandas.variables)".

Instead, use the procedure described in this video:
https://youtu.be/lhbpra2dILA
> --
> You received this message because you are subscribed to the Google Groups "Biogeme" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to biogeme+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/biogeme/fdb23319-4e4f-4882-922e-566b492ddf97n%40googlegroups.com.

Michel Bierlaire
Transport and Mobility Laboratory
School of Architecture, Civil and Environmental Engineering
EPFL - Ecole Polytechnique Fédérale de Lausanne
http://transp-or.epfl.ch
http://people.epfl.ch/michel.bierlaire

Reply all
Reply to author
Forward
0 new messages