• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Logs csv to JSON or any mechanism to get metrics

Resolved: Logs csv to JSON or any mechanism to get metrics

0
By Isaac Tonny on 16/03/2023 Issue
Share
Facebook Twitter LinkedIn

In this post, we will see how to resolve Logs csv to JSON or any mechanism to get metrics

Question:

i have a log file and i need to extract stats based on logs captured.
Sample log format:
One iteration should be from “data received processing started” to “time taken”
I need to get
  1. Total data, conversion time and process time to complete and total time taken.
  2. Min data, Max data, Avg data — respective conversion time taken for min data, max data and Avg data(for suppose there are 10 iteration – in that min data in that 10 iterations of data, max data in that 10 iterations of data and Average of 10 iterations and their respective conversion, process and time taken)

I started converting csv to json first and thought of extracting from there but am stuck to move further. here is what i tired,
Please suggest me how to move further to get stats or is there any better way to get stats from my provided logs

Best Answer:

You can use pandas to read your csv and pivot the segments corresponding to entries then concat:
This will give you a dataframe of the following form:
You can then easily access min, max and avg:
And the corresponding conversion time:
Edit: adding time taken to the output, you can sum all column elements:

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com

csv json python-3.x
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Is pandas groupby() function always produce a DataFrame with the same order respect to the column we group by?

24/03/2023

Resolved: Kivy widget hierarchy not behaving as expected

24/03/2023

Resolved: Pandas Groupby Get Values from Previous Group

24/03/2023

Comments are closed.

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.