```
data1 = { 'node1': [2,2,3,6],
     'node2': [6,7,7,28],
     'weight': [1,2,1,1], }
df1 = pd.DataFrame(data1, columns = ['node1','node2','weight'])

```

I want to rename the node1 and node 2 in the data1 according in increasing order.
Nodes are 2 3 6 7 28 so they become 1 2 3 4 5 respectively.

So the dataframe becomes-

```
data1 = { 'node1': [1,1,2,3],
     'node2': [3,4,4,5],
     'weight': [1,2,1,1], }
df1 = pd.DataFrame(data1, columns = ['node1','node2','weight'])

```

The data looked like this before

[![enter image description here](https://i.stack.imgur.com/kyiKC.png)](https://i.stack.imgur.com/kyiKC.png)

but now looks like this

[![enter image description here](https://i.stack.imgur.com/RqpW1.png)](https://i.stack.imgur.com/RqpW1.png)