편집 기록

편집 기록
  • 프로필 nowp님의 편집
    날짜2020.11.20

    TypeError: list indices must be integers or slices, not str 정수? str? 잘 모르겠습니다.


    TypeError: list indices must be integers or slices, not str 에러가 뜨는데 어떻게 해결해야될지 모르겠습니다, str 대신 int도 넣어봤는데 안되더라구요

    //tsne = TSNE(random_state=0, n_iter=300, learning_rate=100)
    X_tsne = tsne.fit_transform(X_sub)
    plt.figure(figsize=(10, 10))
    plt.xlim(X_tsne[:, 0].min(), X_tsne[:, 0].max() + 1)
    plt.ylim(X_tsne[:, 1].min(), X_tsne[:, 1].max() + 1)
    for i in range(len(X)):
        # 숫자 텍스트를 이용해 산점도를 그립니다
        plt.text(X_tsne[i, 0], X_tsne[i, 1], str(X.target[i]),
                 color = colors[X.target[i]],
                 fontdict={'weight': 'bold', 'size': 9})
    plt.xlabel("t-SNE feature 0")
    plt.xlabel("t-SNE feature 1")
    
  • 프로필 Jinoo0807님의 편집
    날짜2020.11.19

    TypeError: list indices must be integers or slices, not str 정수? str? 잘 모르겠습니다 ㅠㅠ


    TypeError: list indices must be integers or slices, not str 에러가 뜨는데 어떻게 해결해야될지 모르겠습니다, str 대신 int도 넣어봤는데 안되더라구요

    //tsne = TSNE(random_state=0, n_iter=300, learning_rate=100)
    X_tsne = tsne.fit_transform(X_sub)
    plt.figure(figsize=(10, 10))
    plt.xlim(X_tsne[:, 0].min(), X_tsne[:, 0].max() + 1)
    plt.ylim(X_tsne[:, 1].min(), X_tsne[:, 1].max() + 1)
    for i in range(len(X)):
        # 숫자 텍스트를 이용해 산점도를 그립니다
        plt.text(X_tsne[i, 0], X_tsne[i, 1], str(X.target[i]),
                 color = colors[X.target[i]],
                 fontdict={'weight': 'bold', 'size': 9})
    plt.xlabel("t-SNE feature 0")
    plt.xlabel("t-SNE feature 1")