git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

OT: Is there a name for this transformation?


Given a csv file with the following contents

20180701, A
20180702, A, B
20180703, A, B, C
20180704, B, C
20180705, C

I would like to transform the underlying data into a dataframe such as

    date,     A,     B,     C
20180701,  True, False, False
20180702,  True,  True, False
20180703,  True,  True,  True
20180704, False,  True,  True
20180705, False, False,  True

the idea is that the first field in each line of the csv is the row
index of the dataframe. The subsequent fields will be its column names
and the values in the dataframe tell whether that element is present
or not in the line.

Is there a name for this transformation? Any existing code/library
that can transform data back and forth between the two formats? I can
write one myself if there is none but trying to avoid reinventing the
wheel if possible.

thanks in advance
raju
-- 
Kamaraju S Kusumanchi | http://raju.shoutwiki.com/wiki/Blog