Dataframe into numpy array with values comma seperated

后端 未结 3 722
-上瘾入骨i
-上瘾入骨i 2021-01-14 21:53

The Scenario

I\'ve read a csv (which is \\t seperated) into a Dataframe, which is now needed to be in a numpy array format for clustering without changing type

3条回答
  •  没有蜡笔的小新
    2021-01-14 22:54

    Why don't you just import the 'csv' as a numpy array?

    import numpy as np 
    def read_file( fname): 
        return np.genfromtxt( fname, delimiter="/t", comments="%", unpack=True) 
    

提交回复
热议问题