I have a table with 20K + columns and when I call rename on my data frame nothing changes! I have confirmed that the keys in my dictionary match to the column labels so I would expect that the rename function would have some effect but it doesn't.
Here is my code.
"""
Create a dictionary where the bar codes are the keys and the gene names are the
values.
"""
def mkB2G():
fh = open("convert.csv","r")
r={k2[0]:k2[1].replace("\r","") for k2 in [k.split(",") for k in fh.read().split("\n")[1:-1]]}
fh.close()
return(r)
print("reading conversion table")
barToGeneName = mkB2G()
#print(barToGeneName)
print("reading expression table")
#expressionData = pd.read_csv("TS19.Pool.QC.bcNorm.log2_v02.csv",header=0,index_col=0)
expressionData = pd.read_csv("firstTenRows.csv",header=0,index_col=0)
print("renaming expression table")
#print(set(barToGeneName).intersection(set(list(expressionData.columns))))
# ^ Prints all the column labels.
expressionData.rename(columns = barToGeneName)
#print(list(expressionData.columns))
# ^ Still prints the original column labels...
Is there some upper limit to the number of columns where rename is supported in pandas? Or am I making some other error?