pandas set column name in row
xxxxxxxxxx
Hi World!
In my solution for this problem or question i will read exel file (or if you wont to use on csv file is the same):
- Example of my data:
Unnamed: 0 Unnamed: 1 Unnamed: 2
0 NaN NaN NaN
1 Last save 2022-11-21 NaN
2 work food street distance <--- this would to be the header
3 Code Inc. The best burger 1.45 km
- Code solutions:
```
# importing pandas module
import pandas as pd
# reading the exel file and skip first 3 rows
exelDataFrame = pd.read_excel('./best_route.xlsx', skiprows= 3)
# print utput DataFrame with Dtypes
print("\ninit",exelDataFrame,"\n\n\n",exelDataFrame.dtypes)
```
- Code Output:
work food street distance <--- this is the rigth result i wont
1 Code Inc. The best burger 1.45
work object
food street object
distance float64
- Conclusion:
I hope there are helpful this solution