Getting floating points labels from file name

I uploaded my files as follows. you will notice the file name begins with a float number before the “csv” extension. The issue is when i upload to edge impulse it grabs only the first number before the period. for example, a file “2.4.csv” the label on edge impulse will be 2. but i want the label to be 2.4. I have to manually edit all labels with the bulk of my data it is quite a heavy task. please help fix this

instead of reading up to a period ‘.’ you can enable it to accept “filename.endswith(”.csv")"

@marvin Yeah the hard part here is how you deal with duplicate values (which we do often), e.g. you have 0.3 twice in your regression dataset; but let me file a bug and think about this a little.

Sure that will be helpful. but you will see the 0.3 has different values in the columns from each other for the two separate files

Actually easy way to fix @marvin:

edge-impulse-uploader --label "0.3" 0.3.csv
edge-impulse-uploader --label "0.5" 0.5.csv
edge-impulse-uploader --label "0.7" 0.7.csv

Throw it in a script, and run the script. Easier than fixing by hand :slight_smile:

Further edge-impulse-uploader documentation: (you also need --api-key for your project, and you can specify whether the data should be upload to training, testing or split automatically)

Here’s a command I have used in the past on my Mac to automatically upload every file in the current directory with a specified label, for example: find . -type f | xargs -Irepl edge-impulse-uploader --category split --label "0.3" --api-key ei_xxx repl

Hi. Sorry for the late reply. This worked or me. @jenny that would not work for me i have so many files with different labels so i need to grab everything and upload to edge impulse. @janjongboom maybe not such a furnished script but it worked magic for me. thanks

import pandas as pd
import os
directory ='//home/marvin/Joseph_files'
for filename in os.listdir(directory):
	if filename.endswith(".csv") :
		os.system("edge-impulse-uploader --label """+lbl+" "+filename+"")