Is there any way to properly load fixed width file into a dataframe using Pandas? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: Is there any way to properly load fixed width file into a dataframe using Pandas? (/thread-17132.html) |
Is there any way to properly load fixed width file into a dataframe using Pandas? - vicky53 - Mar-29-2019 Hi, Is there any way to properly load and write fixed width file into a dataframe using Pandas? I'm trying to load a fixed width file using pandas read_fwd as below, but the spaces are getting trimmed now. input_df = pd.read_fwf('fwfile', widths=[24,4,59,28,2,12,121], skiprows=0, parse_dates=True, dtype=str)Can you guys please suggest any solution for this issue? RE: Is there any way to properly load fixed width file into a dataframe using Pandas? - Larz60+ - Mar-29-2019 Please supply a short (just a few lines) file to work with. If you use 'New Reply' button, rather than Quick Reply, you can attach the file. |