Skip to main content

IndexError: list index out of range

Answered

Comments

2 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support.
  • Matthias Miltenberger
    • Gurobi Staff

    Hi Geoffrey!

    Most likely, there is an empty line in your text file. You would need to catch this edge case to avoid such errors.

    Maybe it makes sense to look into some existing parsers, e.g., from the pandas module (Pandas: How to Read and Write Files – Real Python) to generate a DataFrame right away and have a more robust parser with more options and flexibility.

    Cheers,
    Matthias

    0

Post is closed for comments.