Domanda di colloquio di Google

1 Programming, I chosen python. How to get top ten data (from last column) from comma separated flat file

Risposte di colloquio

Anonimo

29 apr 2020

abc.csv - CSV file name import pandas as pd df = pd.read_csv('abc.csv') df.iloc[:,-1].head(10)

2

Anonimo

4 set 2017

Could I know what do you mean by "from last column" here? Thanks

1

Anonimo

12 dic 2018

unix: awk -F',' '{print $NF}' test.csv |sort -r -n |head Python: f = open(r"test.csv", "r") res=[] for i in f: res.append(int(i.split(',')[-1].split('\n')[0])) print(sorted(res,reverse=True)[:10])

2

Anonimo

4 set 2017

Huh, I got it cat file | awk -F',' '{print $NF}' | sort | head -n 10