Is it possible or how to define a `datasets.Sequence` that could potentially be either a dict, a str, or None?
MEMBER
Hi ! `datasets` uses Apache Arrow as backend to store the data, and it requires each column to have a fixed type. Therefore a column can't have a mix of dicts/lists/strings.

Though it's possible to have one (nullable) field for each type:
```python
features = Features({
    "text_alone": Value("string"),
    "text_with_idxes": {
        "text": Value("string"),
        "idxes": Value("int64")
    }
})
```

but you'd have to reformat your data fiels or define a [dataset loading script](https://huggingface.co/docs/datasets/dataset_script) to apply the appropriate parsing.

Alternatively we could explore supporting the Arrow [Union](https://arrow.apache.org/docs/python/generated/pyarrow.UnionType.html) type which could solve this issue, but I don't know if it's well supported in python and with the rest of the ecosystem like Parquet
2023-04-04T16:43:36Z
https://github.com/huggingface/datasets/issues/5702#issuecomment-1496288030
https://api.github.com/repos/huggingface/datasets/issues/5702
IC_kwDODunzps5ZL4se
https://api.github.com/repos/huggingface/datasets/issues/comments/1496288030/reactions
2023-04-04T16:43:36Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1496288030
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
NONE
@lhoestq  Thank you! I further wonder if it's possible to use list subscripts as keys of a feature? Like
```python
features = Features({
    0: Value("string"),
    1: {
        "text": Value("string"),
        "idxes": [Value("int64")]
    },
    2: Value("string"),
    # ...
})
```
2023-04-05T03:22:08Z
https://github.com/huggingface/datasets/issues/5702#issuecomment-1496868957
https://api.github.com/repos/huggingface/datasets/issues/5702
IC_kwDODunzps5ZOGhd
https://api.github.com/repos/huggingface/datasets/issues/comments/1496868957/reactions
2023-04-05T03:22:59Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1496868957
https://avatars.githubusercontent.com/u/10508116?v=4
https://api.github.com/users/gitforziio/events{/privacy}
https://api.github.com/users/gitforziio/followers
https://api.github.com/users/gitforziio/following{/other_user}
https://api.github.com/users/gitforziio/gists{/gist_id}
https://github.com/gitforziio
gitforziio
MDQ6VXNlcjEwNTA4MTE2
https://api.github.com/users/gitforziio/orgs
https://api.github.com/users/gitforziio/received_events
https://api.github.com/users/gitforziio/repos
https://api.github.com/users/gitforziio/starred{/owner}{/repo}
https://api.github.com/users/gitforziio/subscriptions
User
https://api.github.com/users/gitforziio
public
MEMBER
Column names need to be strings, so you could use "1", "2", etc. or give appropriate column names
2023-04-05T10:07:23Z
https://github.com/huggingface/datasets/issues/5702#issuecomment-1497238961
https://api.github.com/repos/huggingface/datasets/issues/5702
IC_kwDODunzps5ZPg2x
https://api.github.com/repos/huggingface/datasets/issues/comments/1497238961/reactions
2023-04-05T10:07:23Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1497238961
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
NONE
@lhoestq Got it. Thank you!
2023-04-05T14:15:17Z
https://github.com/huggingface/datasets/issues/5702#issuecomment-1497566072
https://api.github.com/repos/huggingface/datasets/issues/5702
IC_kwDODunzps5ZQwt4
https://api.github.com/repos/huggingface/datasets/issues/comments/1497566072/reactions
2023-04-05T14:15:17Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1497566072
https://avatars.githubusercontent.com/u/10508116?v=4
https://api.github.com/users/gitforziio/events{/privacy}
https://api.github.com/users/gitforziio/followers
https://api.github.com/users/gitforziio/following{/other_user}
https://api.github.com/users/gitforziio/gists{/gist_id}
https://github.com/gitforziio
gitforziio
MDQ6VXNlcjEwNTA4MTE2
https://api.github.com/users/gitforziio/orgs
https://api.github.com/users/gitforziio/received_events
https://api.github.com/users/gitforziio/repos
https://api.github.com/users/gitforziio/starred{/owner}{/repo}
https://api.github.com/users/gitforziio/subscriptions
User
https://api.github.com/users/gitforziio
public
### Feature request

Hello! Apologies if my question sounds naive:

I was wondering if it’s possible, or how one would go about defining a 'datasets.Sequence' element in datasets.Features that could potentially be either a dict, a str, or None?

Specifically, I’d like to define a feature for a list that contains 18 elements, each of which has been pre-defined as either a `dict or None` or `str or None` - as demonstrated in the slightly misaligned data provided below:

```json
[
  [
    {"text":"老妇人","idxes":[0,1,2]},null,{"text":"跪","idxes":[3]},null,null,null,null,{"text":"在那坑里","idxes":[4,5,6,7]},null,null,null,null,null,null,null,null,null,null],
  [
    {"text":"那些水","idxes":[13,14,15]},null,{"text":"舀","idxes":[11]},null,null,null,null,null,{"text":"在那坑里","idxes":[4,5,6,7]},null,{"text":"出","idxes":[12]},null,null,null,null,null,null,null],
  [
    {"text":"水","idxes":[38]},
    null,
    {"text":"舀","idxes":[40]},
    "假",  // note this is just a standalone string
    null,null,null,{"text":"坑里","idxes":[35,36]},null,null,null,null,null,null,null,null,null,null]]
```

### Motivation

I'm currently working with a dataset of the following structure and I couldn't find a solution in the [documentation](https://huggingface.co/docs/datasets/v2.11.0/en/package_reference/main_classes#datasets.Features).

```json
{"qid":"3-train-1058","context":"桑桑害怕了。从玉米地里走到田埂上，他遥望着他家那幢草房子里的灯光，知道母亲没有让他回家的意思，很伤感，有点想哭。但没哭，转身朝阿恕家走去。","corefs":[[{"text":"桑桑","idxes":[0,1]},{"text":"他","idxes":[17]}]],"non_corefs":[],"outputs":[[{"text":"他","idxes":[17]},null,{"text":"走","idxes":[11]},null,null,null,null,null,{"text":"从玉米地里","idxes":[6,7,8,9,10]},{"text":"到田埂上","idxes":[12,13,14,15]},null,null,null,null,null,null,null,null],[{"text":"他","idxes":[17]},null,{"text":"走","idxes":[66]},null,null,null,null,null,null,null,{"text":"转身朝阿恕家去","idxes":[60,61,62,63,64,65,67]},null,null,null,null,null,null,null],[{"text":"灯光","idxes":[30,31]},null,null,null,null,null,null,{"text":"草房子里","idxes":[25,26,27,28]},null,null,null,null,null,null,null,null,null,null],[{"text":"他","idxes":[17]},{"text":"他家那幢草房子","idxes":[21,22,23,24,25,26,27]},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"远"],[{"text":"他","idxes":[17]},{"text":"阿恕家","idxes":[63,64,65]},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"变近"]]}
```

### Your contribution

I'm going to provide the dataset at https://huggingface.co/datasets/2030NLP/SpaCE2022 .