extract data from CSV coloumn

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tresa
    New Member
    • Nov 2017
    • 1

    extract data from CSV coloumn

    I have a scenario where I am extracting a row value from a csv file(attached).

    Here I am trying to get the value of "server_hit_rat e" which is 99% & belongs to 3rd row data. But with this below code I am able to get the data which is in first row only. any advice to achieve the following will be helpful.

    Code:
    df = pd.read_csv('1.csv',skipfooter=1)
    df2 = pd.read_csv('2.csv',skipfooter=1)
    combined = pd.merge(df[['Host',' Time Up']],df2[['Host',' Time OK']], on='Host')
    combined[' Time OK'] = combined[' Time OK'].apply(lambda x: x.split('(')[0])
    combined[' Time Up'] = combined[' Time Up'].apply(lambda x: x.split('(')[0])
Working...