-1
import pandas
data = pandas.read_table("D:\Machine Learning SW\MusicRec\lastfm-dataset- 360K\usersha1-artmbid-artname-plays.tsv",
usecols=[0, 2, 3],
names=['user', 'artist', 'plays'])
# map each artist and user to a unique numeric value
data['user'] = data['user'].astype("category")
data['artist'] = data['artist'].astype("category")
# create a sparse matrix of all the artist/user/play triples
plays = coo_matrix((data['plays'].astype(float),
(data['artist'].cat.codes,
data['user'].cat.codes)))
データのdtypeはobjectです。カテゴリにどのようにタイプキャストするのですか?データ型カテゴリがわからない?
:
をそして、それは特定のカラムに対してのみだ場合元のデータセットのサンプルを表示して、私たちにお手伝いしましょう。 –