# Importing a CSV with multiple labels

**URL:** <https://support.prodi.gy/t/importing-a-csv-with-multiple-labels/67>\
**Category:** Uncategorized\
**Tags:** usage, database, solved\
**Created:** [October 25, 2017, 6:56pm UTC](https://support.prodi.gy/t/importing-a-csv-with-multiple-labels/67 "2017-10-25T18:56:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wei](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@wei](https://support.prodi.gy/u/wei)\
**Post date:** [October 25, 2017, 6:56pm UTC](https://support.prodi.gy/t/importing-a-csv-with-multiple-labels/67/1 "2017-10-25T18:56:44Z")

</div>

What’s the best way to import a CSV with multiple labels, using `db-in`?

I could alternatively split up the dataset and import each label separately, but I don’t see a flag for setting the label similar to the `--answer` flag.

---

<div class="post-metadata">

**Author:** ![wei](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@wei](https://support.prodi.gy/u/wei)\
**Post date:** [October 25, 2017, 7:01pm UTC](https://support.prodi.gy/t/importing-a-csv-with-multiple-labels/67/2 "2017-10-25T19:01:07Z")

</div>

I just read [this other answer](https://support.prodi.gy/t/automating-the-annotation-for-textcat-teach-base-on-score/64) and perhaps the best way is to convert my CSV into JSON with labels. Just wondering whether there is an easier way to import the labels in the CSV directly (it’s one-hot encoded).

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [October 25, 2017, 7:08pm UTC](https://support.prodi.gy/t/importing-a-csv-with-multiple-labels/67/3 "2017-10-25T19:08:58Z")

</div>

Do you mean multiple labels as in, multiple labels on each example?

`db-in` lets you load data in all file formats supported by Prodigy. The CSV loader supports the column headers `Text`, `Label` and `Meta`, and will transform those accordingly on import or on load (see the “Input formats” section of the README for details). For example:

```json
Text,Label,Meta
This is another sentence.,NEGATIVE,0.1

```

```json
{"text": "This is a sentence", "label": "POSITIVE", "meta": {"meta": 0.1}}

```

However, if your data is more complex than that, or if you’re trying to import NER annotations, the best strategy is probably to convert it to JSON or JSONL first and then import it via `db-in`.

---

<div class="post-metadata">

**Author:** ![wei](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@wei](https://support.prodi.gy/u/wei)\
**Post date:** [October 25, 2017, 9:23pm UTC](https://support.prodi.gy/t/importing-a-csv-with-multiple-labels/67/4 "2017-10-25T21:23:08Z")

</div>

Awesome, this solves my issue. Thanks answering and for building a great tool!
