By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,988 Members | 1,367 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,988 IT Pros & Developers. It's quick & easy.

extract data from CSV coloumn

P: 1
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_rate" 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.

Expand|Select|Wrap|Line Numbers
  1. df = pd.read_csv('1.csv',skipfooter=1)
  2. df2 = pd.read_csv('2.csv',skipfooter=1)
  3. combined = pd.merge(df[['Host',' Time Up']],df2[['Host',' Time OK']], on='Host')
  4. combined[' Time OK'] = combined[' Time OK'].apply(lambda x: x.split('(')[0])
  5. combined[' Time Up'] = combined[' Time Up'].apply(lambda x: x.split('(')[0])
Nov 12 '17 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.