Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with format when parsing activity.txt #41

Open
ghostSystem opened this issue Jul 8, 2018 · 2 comments
Open

Issue with format when parsing activity.txt #41

ghostSystem opened this issue Jul 8, 2018 · 2 comments

Comments

@ghostSystem
Copy link
Contributor

Hi,

If I try to parse activity.txt file using Pandas, I get the output in a weird format.
Even though the columns are separate in activity.txt file, after parsing it through pandas all the columns are merged as one.

Is there a workaround to separate out the columns/clean the data so that it can be processed further ?

screen shot 2018-07-08 at 6 03 44 am

@ghostSystem
Copy link
Contributor Author

ghostSystem commented Jul 19, 2018

@astrofrog

I came up with my solution to parse the data so that we can perform some data analysis on it.
I converted the activity.log file into a pandas DataFrame. (refer the image in the first post for the initial output).
Please do have a look. Will hardly take 5 mins. Do share your comments.

Data Parsing Logic

@NewbiZ
Copy link

NewbiZ commented Aug 18, 2018

This is no more than 2 lines of code to convert the file to a DataFrame.

def psrecord2df(path):
    data = open(path).read().splitlines()[1:]
    data = [[float(c) for c in l.split()] for l in data]
    return pd.DataFrame(
        data=data,
        columns=['Elapsed time', 'CPU (%)', 'Real (MB)', 'Virtual (MB)'])

I think the ticket can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants