Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/naseem1amjad/python-csv-list-conversion-manipulation
Read String as CSV and do the manipulation using Python
https://github.com/naseem1amjad/python-csv-list-conversion-manipulation
algorithm array-manipulations assignment csv-format find list python3 search source-code spreadsheet-manipulation test
Last synced: 9 days ago
JSON representation
Read String as CSV and do the manipulation using Python
- Host: GitHub
- URL: https://github.com/naseem1amjad/python-csv-list-conversion-manipulation
- Owner: naseem1amjad
- License: mit
- Created: 2021-11-23T04:59:41.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-23T05:09:41.000Z (almost 3 years ago)
- Last Synced: 2024-06-13T09:02:53.302Z (5 months ago)
- Topics: algorithm, array-manipulations, assignment, csv-format, find, list, python3, search, source-code, spreadsheet-manipulation, test
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Problem Statement:
Write source code in Python that will do following:
There are 2 strings S and C. String S represents a table in CSV format, where rows are separated by newline characters ('\n') and each row consists of one or more fields separated by commas (',').The first row contains the names of columns and the following row contains the values.
For example, the table below is presented by the following string S: "id,name,age,gender,room,dep.\n1,Joe,54,M,12,8\n17,Betty,29,F,15,6".
+--+------+----+--------+------+------+
| id | name | age | gender | room | dep. |
+--+------+----+--------+------+------+
| 1 | Joe | 54 | M | 12 | 8 |
| 7 | Betty | 29 | F | 15 | 6 |
+--+------+----+--------+------+------+String C is the name of the column described by S that contains only integers. The requirement is to find the maximum value in that column. In the example above, for C = "age" , the maximum value is 54.
I have written a function:
class Solution { public int solution(String S, String C); }
which, given 2 strings S and C consisting of N and M characters, respectively, returns the maximum value in column C of the table described by S.Examples:
1. Given S = "area,land,\n3722,CN\n6612,RU\n3855,CA\n3797,USA" and C="area"+-------+-------+
| area | land |
+-------+-------+
| 3722 | CN |
| 6612 | RU |
| 3855 | CA |
| 3797 | USA |
+-------+-------+the function will return 6612
2. Given S = "city,temp2,temp\nParis,7,-3\nKarachi,4,-4\nLahore,-1,-2" and C="temp"
+--------+---------+--------+
| city | temp2 | temp |
+--------+---------+--------+
| Paris | 7 | -3 |
| Karachi | 4 | -4 |
| Lahore | -1 | -2 |
+--------+---------+---------+the function with return -2
## Keywords:
Python, Source Code, Algorithm, SpreadSheet, CSV Format to Array/List conversion, Find in List, Minium Value, Array Manipulation