Every line of 'pandas select row by index' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
525 def get_selection_by_index(df, position, orientation='side'): 526 ''' 527 Grabs and returns a single column or row. 528 example: myrow = get_selection_by_index(mydf, 2, 'side') 529 grabs row 2 from df. 530 ''' 531 532 if orientation == 'side': 533 #will return a single row 534 df = df.ix[[position],:] 535 else: 536 #will return a single col 537 df = df.ix[:,[position]] 538 539 return df
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
74 def _select(a, indexes): 75 return [h for h, i in zip(a, range(len(a))) if i in indexes]