I have a csv file and I'm loading it as follows:
sc.textFile("market.csv").take(3)
The output is this:
['"ID","Area","Postcode","Amount"',
'"1234/232","City","8479","20000"',
'"5987/215","Metro","1111","25000"']
Also, loading with map operation:
sc.textFile("market.csv").map(lambda line: line.split(","))
Gives me:
[['"ID"','"Area"','"Postcode"','"Amount"'],
['"1234/232"','"City"','"8479"','"20000"'],
['"5987/215"','"Metro"','"1111"','"25000"']]
This is too many " " and ' ' and does not let me analyze my results!!
I want to have an output like this:
[["ID","Area","Postcode","Amount"],
["1234/232","City",8479,20000],
["5987/215","Metro",1111,25000]]
In which the text values are string type, and the numbers are int/double type.
How can I do that? Thanks.