Em 22-09-2019 13:10, Piet van Oostrum escreveu:
Markos <mar...@c2o.pro.br> writes:

Hi,

I have a table.csv file with the following structure:

, Polyarene conc ,, mg L-1 ,,,,,,,
Spectrum, Py, Ace, Anth,
1, "0,456", "0,120", "0,168"
2, "0,456", "0,040", "0,280"
3, "0,152", "0,200", "0,280"

I open as dataframe with the command:

data = pd.read_csv ('table.csv', sep = ',', skiprows = 1)

[snip]

Also I'm also wondering if there would be any benefit of making this
modification in dataframe before extracting the numeric fields to the
array.

Please, any comments or tip?
data = pd.read_csv ('table.csv', sep = ',', skiprows = 1, decimal=b',', 
skipinitialspace=True)

Thank you for the tip.

I didn't realize that I could avoid formatting problems in the dataframe or array simply by using the read_csv command with the correct parameters (sep and decimal).

I searched for information about the meaning of the letter "b" in the parameter decimal=b','  but didn't find.

I found that it also works without the letter b.

Best Regards,
Markos
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to