I often deal with data that is poorly formatted (Ie the number of fields is not consistent, etc.)
There may be other ways that I donβt know about, but the way to format a single column in a data framework is to use a function and map the column to that function.
format = df.column_name.map(format_number)
Question: 1 - what if I have a framework with 50 columns and want to apply this formatting to multiple columns, etc. columns 1, 3, 5, 7, 9,
You can go:
format = df.1,3,5,9.map(format_number)
.. So I could format all my columns on one row?
python pandas slice filtering
yoshiserry Feb 28 '14 at 4:59 2014-02-28 04:59
source share