Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 list all the different options that are filled in

Im currently working on an assignment and we got some template files which we have to use to data mine a csv file.
And we are struggling with the following:

we need to list all the different options that are filled in. But with our code it lists all the options, so also doubles.
we tried to fix this with the CLASSES but this doesn't work.

    csvdirectory = ''
    filename = 'AdventourData.csv'
    Dataset,featuretypes = ReadData(csvdirectory+filename)
    itemtargetclasses = [item[3] for item in Dataset]
    CLASSES = []
    if itemtargetclasses not in CLASSES:
    if featuretypes[3] == 'Numerical':
        print('Minimum is:', min(itemtargetclasses))  
        print('Maximum is:', max(itemtargetclasses)) 
        print('Median is:', np.median(itemtargetclasses))
        print('Mean is:', np.mean(itemtargetclasses)) 
        print('Classes are:', CLASSES)
with kind regards,


ps. pandas are not allowed
metulburr wrote Sep-13-2019, 06:12 PM:
Please use a better thread title next time
You need to loop through itemtargetclasses, not just check the whole thing. But since itemtargetclasses is built with a loop anyway, you can just change how you build it:

itemtargetclasses = []
for item in Dataset:
    if item not in itemtargetclasses:
That way, itemtargetclasses has no duplicates.
Craig "Ichabod" O'Brien -
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures


Top Page

Forum Jump:

Users browsing this thread: 1 Guest(s)