下のコードを実行するとAttributeError: 'numpy.ndarray' object has no attribute 'values'というエラーが出ます。
どなたか解決策をご存知の方助けてくださると助かります!
python3
1#!/usr/bin/env python3 2# -*- coding: utf-8 -*- 3""" 4Created on Tue Jan 15 15:27:36 2019 5 6@author: tanakaeri 7""" 8 9import random 10import numpy as np 11import pandas as pd 12 13list = [random.randint(20, 60) for i in range(6)] 14print(list) 15 16listmin = [] 17listrecord = [] 18listwhere = [] 19 20 21for i in range(1,51): 22 where = min(range(len(list)), key=lambda i: list[i]) 23 24 a = random.randint(20,60) 25 26 27 newmin = min(list)+a 28 list[where] = newmin 29 30 listmin.append(min(list)) 31 32 33 listrecord.append(list[0]) 34 listrecord.append(list[1]) 35 listrecord.append(list[2]) 36 listrecord.append(list[3]) 37 listrecord.append(list[4]) 38 listrecord.append(list[5]) 39 arr_listrecord = np.array(listrecord) #listrecordの一次元配列 40 41 listwhere.append(where) 42 arr_listwhere = np.array(listwhere) 43 44 print(list) 45 46listrecord1 = np.reshape(arr_listrecord, (50, 6)) #listrecord1の49*6の二次元配列 47 48print(listmin) 49print(listrecord) 50print(arr_listrecord) 51print(listrecord1) 52print(arr_listwhere) 53 54 55 56 57for p in range(16,2,-1): #p = 差 58 59 a = 16-p 60 b = 36+a 61 62 later = max(listmin[20+2*a],listmin[21+2*a]) 63 resttime = listmin[b-1]-later #listmin[b-1] = b番目の試合開始時間 64 65 66 67 if 0 <= resttime < 30: 68 start = (30-resttime) + listmin[b-1] 69 elif resttime < 0: 70 start = 30 + (-resttime) + listmin[b-1] 71 else: 72 start = listmin[b-1] 73 74 arr_listrecordupper = listrecord1[:b-2] #listrecord上の部分(array型) 75 arr_listrecordlower = listrecord1[b-1:] #listrecord下の部分(array型) 76 77 df = pd.DataFrame(arr_listrecordlower) 78 79 80 81 if listwhere[b-1] == 0: 82 df = arr_listrecordlower + np.array([start,0,0,0,0,0]) 83 elif listwhere[b-1] == 1: 84 df = arr_listrecordlower + np.array([0,start,0,0,0,0]) 85 elif listwhere[b-1] == 2: 86 df = arr_listrecordlower + np.array([0,0,start,0,0,0]) 87 elif listwhere[b-1] == 3: 88 df = arr_listrecordlower + np.array([0,0,0,start,0,0]) 89 elif listwhere[b-1] == 4: 90 df = arr_listrecordlower + np.array([0,0,0,0,start,0]) 91 else: 92 df = arr_listrecordlower + np.array([0,0,0,0,0,start]) 93 94 a_df = np.array(df.values.flatten()) 95 96 listrecord1 = np.vstack((arr_listrecordupper,a_df)) 97 98print(listrecord[51]) 99 100 101 102 103

下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
また依頼した内容が修正された場合は、修正依頼を取り消すようにしましょう。