Use: DataFrame.add_prefix,
You also need use DataFrame.transpose beforehand because the add_prefix method acts on the columns. It is also necessary to use transpose at the end to return the dataframe to the original form
prefix=str1+'-'+str2+'-00'
df=df.set_index('index').T.add_prefix(prefix).T
print(df)
col1
index
USD-pricing-000 x
USD-pricing-001 x
USD-pricing-002 x
To respond to @razdi comment, to a more general solution, you would use:
prefix=str1+'-'+str2+'-'
df['index']=[(3-len(key))*'0'+key for key in df['index'].astype(str)]
df=df.set_index('index').T.add_prefix(prefix).T
print(df)
Example
df=pd.DataFrame()
df['col1']='x x x x x x x x x x x x x x'.split()
df.reset_index(inplace=True)
print(df)
index col1
0 0 x
1 1 x
2 2 x
3 3 x
4 4 x
5 5 x
6 6 x
7 7 x
8 8 x
9 9 x
10 10 x
11 11 x
12 12 x
13 13 x
Applying the code shown:
prefix=str1+'-'+str2+'-'
df['index']=[(3-len(key))*'0'+key for key in df['index'].astype(str)]
df=df.set_index('index').T.add_prefix(prefix).T
print(df)
col1
index
USD-pricing-000 x
USD-pricing-001 x
USD-pricing-002 x
USD-pricing-003 x
USD-pricing-004 x
USD-pricing-005 x
USD-pricing-006 x
USD-pricing-007 x
USD-pricing-008 x
USD-pricing-009 x
USD-pricing-010 x
USD-pricing-011 x
USD-pricing-012 x
USD-pricing-013 x
Of course this as long as your dataframe has less than 1000 lines.