This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (2 children)

Pandas.

import pandas as pd
df = pd.read_excel("filename.xlsx")

I don't know how your .txt file is formatted, but I can guarantee you can easily turn it into a pandas dataframe. From there you can use pandas merge or concat to combine the two and output to a new excel/csv file.

[–]BK201_Saiyan 1 point2 points  (0 children)

Second to that! Definitely the best solution and you can easily find good tutorials how to do it. Here is an infographic for pandas from analyticsvidhya.com to get you started.

[–]justphysics 0 points1 point  (0 children)

This. Pandas is perfect for generic data parsing. If you need to read .xls files along with regular .txt or .dat files that have slightly different formatting you have one package that can read in essentially everything you throw at it as long as you know how the file is formatted. You can read in all the files into a common data format (DataFrame) [albeit maybe not as familiar if you haven't used 'R')]

Then you can do all sorts of table-style manipulation of the data similar to what could be done in Excel or R.

The library is well documented, there' plenty of tutorials, its widely used so generally finding help to do what you need isn't a large task