turicas / turicas/rows

Add command line option to import CSV with no header

Open
#233 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

cli enhancement
Dominant language
Python
Stars
886
Forks
137
PR merge metrics
No merged PRs in 30d

Description

Currently, if we have a csv file with no header rows cli tries to use it's first line as a header. We need a command line option to tell rows cli that this file has no header.

An example of the problem:

if we have this file:

$ cat teste.csv 
Resende,5894901.865,3304201
Rio Bonito,1363816.215,3304300
Rio Claro,273793.676,3304409
Rio das Flores,167710.938,3304508
Rio das Ostras,13923653.785,3304524
Rio de Janeiro,239418619.857,3304557
Santa Maria Madalena,152724.4,3304607
Santo Antônio de Pádua,858100.972,3304706
Sapucaia,605209.315,3305406
Saquarema,1793363.926,3305505

Rows will print it like this:

$ rows print teste.csv 
+------------------------+------------------+---------------+
|        resende         | field_5894901865 | field_3304201 |
+------------------------+------------------+---------------+
|             Rio Bonito |      1363816.215 |       3304300 |
|              Rio Claro |       273793.676 |       3304409 |
|         Rio das Flores |       167710.938 |       3304508 |
|         Rio das Ostras |     13923653.785 |       3304524 |
|         Rio de Janeiro |    239418619.857 |       3304557 |
|   Santa Maria Madalena |         152724.4 |       3304607 |
| Santo Antônio de Pádua |       858100.972 |       3304706 |
|               Sapucaia |       605209.315 |       3305406 |
|              Saquarema |      1793363.926 |       3305505 |
+------------------------+------------------+---------------+

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the rows print command and trace the CSV import path that currently treats the first row as headers. Define the command-line option behavior for headerless CSV files, then verify that the sample teste.csv keeps Resende as data and uses generated column names instead; add or run the relevant CLI checks if the project provides them.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.