'How to separate line in tuple?
tuples = [
('Vehicle MOB','2021','Nov'),
('Vehicle MOB','2021','Dec'),
('Vehicle MOB','2022','Jan'),
('Vehicle MOB','2022','Feb'),
('Vehicle MOB','2022','Mar'),
('Vehicle MOB','2022','Apr'),
('Vehicle MOB','2022','May'),
('Vehicle MOB','2022','Jun'),
('Vehicle MOB','2022','Jul'),
('Vehicle MOB','2022','Aug'),
('Vehicle MOB','2022','Sep'),
('Vehicle MOB','2022','Oct'),
('Vehicle MOB','2022','Nov'),
('Vehicle MOB','2022','Dec'),
('Vehicle MOB','2022MY\ntotal','')]
Final=pd.MultiIndex.from_tuples(tuples)
df2 = pd.DataFrame(index=[1,2], columns=Final)
I want to break line
2022MY
TOTAL
How can i do it ?
Solution 1:[1]
The line break that you added is already exported to the Excel file that you seem to want to generate. All you have to do is enable text wrapping for that cell.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Erik Wessel |