Giter Site home page Giter Site logo

Last column not being detected about csv HOT 1 OPEN

hi5 avatar hi5 commented on August 22, 2024
Last column not being detected

from csv.

Comments (1)

hi5 avatar hi5 commented on August 22, 2024

In this case it is due to the fact the last line in the TSV only has two columns, so after 07:07 on row 6 there is no tab character, so the file is assumed to have two columns. If you add a tab character or tab+value it would work:

Date	Clock-In	Clock-Out
12022-45-11-07-Mon	207:21	304:37
2022-45-11-08-Tue	07:05	04:19
2022-45-11-09-Wed	07:07	04:13
2022-45-11-10-Thu	07:04	04:02
2022-45-11-11-Fri	07:07	04:05

So you should either ensure that the source of the data (program with export function I assume) writes all cells and thus columns (even if empty) or perform a check prior to reading the data and "append" a missing cell in the last row. Note that if it had been any other row -- you can test this by removing the tab + cell from row 2 for example -- it wouldn't have caused an issue. Only because it happens to be the last row you now notice it. (I didn't write the library although I did contribute to it at the time - and as I'm using it in production and I assume others too I'm hesitant to post updates to fix such things)

Syntax tip: the "name" of the identifier (you use CSV) should be quoted, so "CSV" unless you use CSV as a variable like you have done with csv_filename

CSV_Load(csv_filename,"CSV","`t")
row := CSV_ReadRow("CSV",1)

from csv.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.