Question: Posting question again as requested https://www.coursehero.com/qa/wait/30686928/ Team Looking for expert advice for the usage of python/pandas with dataframe option to deal with file handling to

Posting question again as requested "https://www.coursehero.com/qa/wait/30686928/"

Team

Looking for expert advice for the usage of python/pandas with dataframe option to deal with file handling to convert semicolon to csv

Sample input_file contents

C0-lkb.abc.com:apple.feature.com:500 C0-rbs-out-1.regroup.com:retail.kfc.com:1800 Pwell.kbc.com:knowledge-use.com:::::200:1800 Zaadick.lkb.com:hoster-make.com::400 

Note : File contains records starting with various first letter field . ex C,P,Z,$,# etc .

Expected output_file.csv

Name,Value apple.feature.com:0-lkb.abc.com retail.kfc.com:0-rbs-out-1.regroup.com 
  1. Need to check for only rows which starts with "C" only.
  2. For records starting with "C" . Check only First and Second fields . Ignore other fields
  3. Output file should have header as Name,Value
  4. Second field from input file should be placed in First field of output file .
  5. First field from input file should be placed in Second field of output file. ( Expected sample output file is shared above)

Looking for best approach to handle using Python 3.7.5/pandas preferably using dataframe.

Thanks

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!