Hi ~
I’d like to know how can I remove empty elements.
This is my data setting code:
fields = [("", None),("text", TEXT),("label", LABEL)]
train_data,valid_data, test_data = data.TabularDataset.splits(
                path = '',
                train = 'four_train.csv',
                validation = 'four_valid.csv',
                test = 'four_test.csv',
                format = 'csv',
                fields = fields,
                skip_header = True
)

Data type is “torchtext.data.dataset.TabularDataset”
And I run this code for finding NULL
for i in range(len(train_data)):
    if train_data[i].text[:] == []:
        print(i)

This is the result
424
499
2186
2727
2757
3063
3086
3158
4508
5035
5420
6005
6799
8815
8840
9846
-----Skip~
I know there are a lot of empty elements.
So, how can I remove it?
The reason why i remove it is that it might cause this error:
“RuntimeError: Length of all samples has to be greater than 0, but found an element in ‘lengths’ that is <= 0”, when I run the code.