How do I pass an expression as a function keyword in Python : <p>I am trying to be pythonic with my code but can't figure out how to do:</p>

<pre><code>dfSort.assign(i+5=pd.Series(dfWork))
</code></pre>

<p>where dfSort is a Dataframe and pd is pandas import. Of course the <code>i+5</code> is an expression and therefore cannot be passed as a column name. But I want to assign a column name dynamically in code (called <code>i+5</code>). The only way to do this otherwise is (this can get cumbersome):</p>

<pre><code>if (i+5)== 5:
    dfSort =  dfSort.assign(a=pd.Series(dfWork, index=dfSort.index.values))

elif (i+5)==6:
    dfSort =  dfSort.assign(b=pd.Series(dfWork, index=dfSort.index.values))

elif (i+5)==7:   
    dfSort =  dfSort.assign(c=pd.Series(dfWork, index=dfSort.index.values))

elif (i+5)==8:   
    dfSort =  dfSort.assign(d=pd.Series(dfWork, index=dfSort.index.values))
</code></pre>

<p>Is there a way to do this like the first code block without the if statements?</p>

<p>This doesn't work:</p>

<pre><code>Colname = {5: 'a',6 : 'b', 7 : 'c', 8 : 'd'}   
dfSort =  dfSort.assign(Colname[i+5]=pd.Series(dfWork) ) 
</code></pre>
