GSoC/GCI Archive
Google Code-in 2014 FOSSASIA

Python Simple CSV file manipulation

completed by: Samarjeet Singh

mentors: rebentisch

1) Write a simple python script that takes a comma separated file (e.g. a csv exported spreadsheet) and has the following features/parameters

-- file

specifies the input file, required. E.g. --file myfile.csv

-- rev

outputs the rows in reverse order

e.g.

333, "hello", "there"
222, "more", "light"562, "sun", "wards"

becomes:

562, "sun", "wards"
222, "more", "light"
333, "hello", "there"

-- sort

E.g. --- sort 1 sorts the rows alphabetical/numerical by first column.

-- rows

outputs the count of rows

e.g.

333, "hello", "there", "future"
222, "more", "light", "key"
562, "sun", "wards", "fred"

results in 3

-- col

outputs the count of columns

i.e. 4 in the above example

 

--output

specifies the output file. E.g. output.csv otherwise the output is std_out / screen.

2) Explain a) What difficulties could emerge when you deal with international alphabets e.g. characters like ä,ü,ö and how do you address this issue? b) Why would it be a bad design to simple count the commas and increment by one to implement the --col functionality?