0 votes
1 view
in Data Science by (17.6k points)

I need to obtain the type for each column to properly preprocess it.

Currently I do this via the following method:

import pandas as pd

# input is of type List[List[any]]

# but has one type (int, float, str, bool) per column

df = pd.DataFrame(input, columns=key_labels)

column_types = dict(df.dtypes)

matrix = df.values

Since I only use pandas for obtaining the dtypes (per column) and use numpy for everything else I want to cut pandas from my project.

In summary: Is there a way to obtain (specific) dtypes per column from numpy

!Or: Is there a fast way to recompute the dtype of ndarray (after splicing the matrix)

Please log in or register to answer this question.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !