[Python] How to read log files in Pandas dataframe having multiple delimiters?

Discussão em 'Python' iniciado por Stack, Fevereiro 22, 2025.

  1. Stack

    Stack Membro Participativo

    My log file format is as below :

    2016-09-28 04:30:30, Info CBS Loaded Servicing Stack v6.1.7601.23505 with Core: C:\Windows\winsxs\amd64_microsoft-windows-servicingstack_31bf3856ad364e35_6.1.7601.23505_none_681aa442f6fed7f0\cbscore.dll 2016-09-28 04:30:31, Info CSI 00000001@2016/9/27:20:30:31.455 WcpInitialize (wcp.dll version 0.0.0.6) called (stack @0x7fed806eb5d @0x7fef9fb9b6d @0x7fef9f8358f @0xff83e97c @0xff83d799 @0xff83db2f) 2016-09-28 04:30:31, Info CSI 00000002@2016/9/27:20:30:31.458 WcpInitialize (wcp.dll version 0.0.0.6) called (stack @0x7fed806eb5d @0x7fefa006ade @0x7fef9fd2984 @0x7fef9f83665 @0xff83e97c @0xff83d799) 2016-09-28 04:30:31, Info CSI 00000003@2016/9/27:20:30:31.458 WcpInitialize (wcp.dll version 0.0.0.6) called (stack @0x7fed806eb5d @0x7fefa1c8728 @0x7fefa1c8856 @0xff83e474 @0xff83d7de @0xff83db2f) 2016-09-28 04:30:31, Info CBS Ending TrustedInstaller initialization. 2016-09-28 04:30:31, Info CBS Starting the TrustedInstaller main loop. 2016-09-28 04:30:31, Info CBS TrustedInstaller service starts successfully. 2016-09-28 04:30:31, Info CBS SQM: Initializing online with Windows opt-in: False 2016-09-28 04:30:31, Info CBS SQM: Cleaning up report files older than 10 days. 2016-09-28 04:30:31, Info CBS SQM: Requesting upload of all unsent reports.

    Taken from here https://github.com/logpai/loghub/blob/master/Windows/Windows_2k.log

    I want to read this file in a pandas dataframe with proper column headings . It is having multiple delimeters as ',' space and tab. Please share your thoughts with a running code sample.

    Thanks!

    Continue reading...

Compartilhe esta Página