Python Forum

Full Version: Help with poorly formatted excel data
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello - I have an excel file that is used to visually track and modify a schedule for multiple manufacturing lines. My goal is to write a python script that will reformat the data in the excel file into a format that can be used in more sophisticated visualizations (Tableu / Spotfire ect); however I am having a hard transposing the data.

The excel file is in a wide format, as below where each new column represents a new calendar week and the rows correspond to project information that is planned to be running during that week. The rows would be repeated for different manufacturing lines.

WEEK OF:, 6-Jan, 13-Jan, 20-Jan, 27-Jan, 3-Feb, .....
Project
Activity #1
Activity #2
Comment
Plant Contact

I`d like to reformat the data into a tall format, like below

Week OF:, Project, Activity #1, Activity #2, ect
13-Jan
20-Jan
27-Jan
3-Feb

I can bring the excel into python as a dataframe and slice the dataframe but am stuck on how to transpose it. Any advice?
(Jan-13-2022, 12:00 AM)armitron121 Wrote: [ -> ].... t am stuck on how to transpose it. Any advice?

With Pandas transpose ?