I have this piece of code:
csvData = np.array([]);
csvData = np.append(csvData, ['1', '2016-01-01', 'Some text'])
csvData = np.append(csvData, ['2', '2016-01-02', 'Some more text'])
print(csvData)
it outputs: ['1' '2016-01-01' 'Some text' '2' '2016-01-02' 'Some more text']
I would like to get something like:
[['1' '2016-01-01' 'Some text'], ['2' '2016-01-02' 'Some more text']]
I tried wrapping my data string into []
. The reason I am doing this, because I want to collect each csv row, sort it by specific column and iterate data rows.
Any other solution is welcome.
I would sort using something like: csvData [np.argsort(csvData [:,2])]