I have the following csv file in this structure input file
| Top | Bottom| Value |
|:---- |:------:| -----:|
|1000 | 1003 | 3 |
|1004 | 1006 | 2 |
|1008 | 1010 | 5 |
I would like the result to be
| Top | Value |
|:---- |:------:|
| 1000 | 3 |
| 1000.5 | 3 |
| 1001 | 3 |
| 1001.5 | 3 |
| 1002 | 3 |
| 1002.5 | 3 |
| 1003 | 3 |
| 1003.5 | Nan |
| 1004 | 2 |
| 1004.5 | 2 |
| 1005 | 2 |
| 1005.5| 2 |
| 1006 | 2 |
| 1006.5 | Nan |
| 1007 | Nan |
| 1007.5 | Nan |
| 1008 | 5 |
| 1008.5 | 5 |
| 1009 | 5 |
| 1009.5 | 5 |
| 1010 | 5 |
I have tried this code:
df= 'D:\\Range.csv'
df = pd.read_csv(df,header=[0])
df = df.set_index('value')
print (df)
stacked = df.stack()
stacked=stacked.reset_index()
print(stacked)