My first question here. I hope I can make it as clear and informative as possible.
I am currently using python, and new to it. I love the language though, a lot of simplifications that keep your code very concise.
I currently have a function that accepts an argument. That argument gets overwritten even if I copy it to a local variable inside the function. Even when copied outside of the function (and the argument passed to the function) it overwrites the original argument.
Here the function: The argument I'm talking of is resultsvalidationparam. It might be a straightforward mistake as I've been staring at this for a while now, but I couldn't find an answer to my problem on the Internet.
    def mean_cluster_validation(resultsvalidationparam, validationmethods, mean_methods = 'relative'):
resultsvalidation = resultsvalidationparam
n_clusters = np.arange(2,2 + len(resultsvalidation.keys()))
clustermethods = tuple(resultsvalidation[str(2)].keys())
'''
First we find the best and worst score for each validation method (which gives a certain clustern and clustermethod). After which all scores are made
relative to those scores (giving them values between 0 and 1). Some validations methods are best when low or high values, this is taken into account. 
'''    
# Find max and min
validationMax = {}
validationMin = {}
for t in validationmethods:
    currentMax = (0,)# list containing max value, clustering method and number of clusters where value is max for certain validation method
    currentMin = (100000,)
    for i in n_clusters:
        for j in clustermethods: 
            if resultsvalidation[str(i)][j][t] is not None:
                if resultsvalidation[str(i)][j][t] > currentMax[0]:
                    currentMax = (resultsvalidation[str(i)][j][t],i,j)
                if resultsvalidation[str(i)][j][t] < currentMin[0]:
                    currentMin = (resultsvalidation[str(i)][j][t],i,j)
    validationMax[t] = currentMax
    validationMin[t] = currentMin
for t in validationmethods:
    for i in n_clusters:
        for j in clustermethods:
            if resultsvalidation[str(i)][j][t] is not None:
                resultsvalidation[str(i)][j][t] = (resultsvalidation[str(i)][j][t] - validationMin[t][0])/(validationMax[t][0] - validationMin[t][0])
return validationMax, validationMin, resultsvalidation
Even when I use a copy (e.g. 't') outside of the function of the variable, it still overwrites the original variable
I'm pretty stuck, again, apologies if I incorrectly formulated the question, my english is pretty poor.
 
     
     
     
    