I am grouping values by type as follows:
groups = frame.columns.to_series().groupby(frame.dtypes).groups
by I get error:
TypeError: data type not understood
What would be the right way to go about grouping columns by datatype to prevent such errors?
EDIT: Sample input
0 0 0 1985 ATL NL barkele01 870000 428.0 428.0 1955.0 ... Leonard Harold 225.0 77.0 R R 1976-09-14 1987-09-26 barkl001 barkele01 both
1 1 1 1985 ATL NL bedrost01 550000 559.0 559.0 1957.0 ... Stephen Wayne 200.0 75.0 R R 1981-08-14 1995-08-09 bedrs001 bedrost01 both
2 2 2 1985 ATL NL benedbr01 545000 614.0 614.0 1955.0 ... Bruce Edwin 175.0 73.0 R R 1978-08-18 1989-09-11 beneb001 benedbr01 both
3 3 3 1985 ATL NL campri01 633333 NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN left_only
4 4 4 1985 ATL NL ceronri01 625000 1466.0 1466.0 1954.0 ... Richard Aldo 192.0 71.0 R R 1975-08-17 1992-07-10 ceror001 ceronri01 both
5 5 5 1985 ATL NL chambch01 800000 1481.0 1481.0 1948.0 ... Carroll Christopher 195.0 73.0 L R 1971-05-28 1988-05-08 chamc001 chambch01 both
Sample output would be smth like
{float: [columns], int:[columns], string:[columns]}