Re: Preprocessing not quite fixed-width file before parsing

2022-11-25 Thread Loris Bennett
Thomas Passin writes: > On 11/24/2022 9:06 AM, Loris Bennett wrote: >> Thomas Passin writes: >> >>> On 11/23/2022 11:00 AM, Loris Bennett wrote: Hi, I am using pandas to parse a file with the following structure: Name filesettype KB quota limit >>>

Re: Preprocessing not quite fixed-width file before parsing

2022-11-24 Thread Thomas Passin
On 11/24/2022 9:06 AM, Loris Bennett wrote: Thomas Passin writes: On 11/23/2022 11:00 AM, Loris Bennett wrote: Hi, I am using pandas to parse a file with the following structure: Name filesettype KB quota limit in_doubtgrace |files quotalimit in_d

Re: Preprocessing not quite fixed-width file before parsing

2022-11-24 Thread Loris Bennett
Thomas Passin writes: > On 11/23/2022 11:00 AM, Loris Bennett wrote: >> Hi, >> I am using pandas to parse a file with the following structure: >> Name filesettype KB quota limit >> in_doubtgrace |files quotalimit in_doubtgrace >> shortname shared

Re: Preprocessing not quite fixed-width file before parsing

2022-11-23 Thread Thomas Passin
On 11/23/2022 11:00 AM, Loris Bennett wrote: Hi, I am using pandas to parse a file with the following structure: Name filesettype KB quota limit in_doubt grace |files quotalimit in_doubtgrace shortname sharedhome USR14097664 52428800

Re: Preprocessing not quite fixed-width file before parsing

2022-11-23 Thread Weatherby,Gerard
This seems to work. I’m inferring the | is present in each line that needs to be fixed. import pandas import logging class Wrapper: """Wrap file to fix up data""" def __init__(self, filename): self.filename = filename def __enter__(self): self.fh = open(self.filena

Re: Preprocessing not quite fixed-width file before parsing

2022-11-23 Thread Weatherby,Gerard
: df = pandas.read_csv(f, delimiter=r"\s+") print(df) From: Weatherby,Gerard Date: Wednesday, November 23, 2022 at 3:38 PM To: Loris Bennett , python-list@python.org Subject: Re: Preprocessing not quite fixed-width file before parsing This seems to work. I’m inferring the | is