Random Forest Code Optimization
I have notes on style and redundancies, but you should read the Python Style Guide: PEP0008. It has a lot of good info on how to format your code to be clear and readable for yourself and others. I'll miss pointing out some of it's recommendations so do read it too.

You have a lot of unnecessary inline comments. from package import Class makes it pretty clear that you're importing Class from package. Python is designed to be readable so that you don't need to explicitly tell people these things. I'd remove most of them. In particular, with your long if and elif chains it's be better to cut down on repetition. Both by having only one comment at the top, and by putting n=n+1 at the end. Though, you can rewrite that as n+=1, and you should put spaces around operators, makes them easier to read:

for row in data["H2S"]:
    #Assign response based on H2S concentration and do indexing
    if row &lt; 120:
        data['response'].iloc[n] = s[0] 
    elif row &gt;= 120 and row &lt; 500:
        data['response'].iloc[n] = s[1] 
    elif row &gt;= 500 and row &lt; 1000:
        data['response'].iloc[n] = s[2] 
    elif row &gt;= 1000 and row &lt; 1300:
        data['response'].iloc[n] = s[3] 
    else: 
        data['response'].iloc[n] = s[4] 
    n += 1


But actually you could just use enumerate for your for loop instead. It allows you to do the same as what you're using n for, it contains the number iteration you're on. So you can save a line and just do this:

for n, row in enumerate(data["H2S"]):
    #Assign response based on H2S concentration and do indexing
    if row &lt; 120:
        data['response'].iloc[n] = s[0] 

    ...

    else: 
        data['response'].iloc[n] = s[4] 


No need for the n += 1 any more.

You never use len_column except to assign to len_iteration, so just assign directly to len_iteration:

len_iteration = len(new_data.columns) - 1


You shouldn't use the semicolon line separator, it's rarely a good idea and often just looks unPythonic. Anyway, Python lets you assign multiple values at once by comma separating them:

j, i, k = 3000, 0, 0


Having them out of alphabetical order is a bit confusing though. You'd be better giving these meaningful names since their usage isn't simple.

In you're while loop you increment i and j in both conditions, so you should just do that at the end and just run the middle block if your condition is False:

while i &lt; len_iteration:
    if int(colnames[i]) != j:
        for k in range(0, b):    
            new_col.iloc[k] = (new_data.iloc[k,i-1]+new_data.iloc[k,i+1])/2
        new_data.insert(i,str(j),new_col)
        colnames = list(new_data)
        len_iteration += 1;
    j += 5
    i += 1


That block could really do with some comments though. Especially this line:

new_col.iloc[k] = (new_data.iloc[k, i - 1] + new_data.iloc[k, i + 1]) / 2


I have no idea what that's doing.

You also use m, n and p for indexing. If you're not going to give them more meaningful names, you can at least re-use i, j and k which are more commonly used for looping over indices.