AttributeError: 'list' object has no attribute 'astype'
I run this code using pandas in virtual environment and it prints this error on powershell on windows 

==========================================================
 FutureWarning: Sorting because non-concatenation axis is not aligned. A future version
of pandas will change to not sort by default.

To accept the future behavior, pass 'sort=False'.

To retain the current behavior and silence the warning, pass 'sort=True'.

  total_data = pd.concat([frames[0],frames[1],frames[2]], ignore_index=True)
Traceback (most recent call last):
  File "data_analysis.py", line 64, in <module>
    counts_data = DataFrame(user_dict, index=['user', 'followers', 'follows']).T
  File "C:\Users\hp\Desktop\sentanalysis\newvenv\lib\site-packages\pandas\core\frame.py", line 348, in __init__
    mgr = self._init_dict(data, index, columns, dtype=dtype)
  File "C:\Users\hp\Desktop\sentanalysis\newvenv\lib\site-packages\pandas\core\frame.py", line 459, in _init_dict
    return _arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
  File "C:\Users\hp\Desktop\sentanalysis\newvenv\lib\site-packages\pandas\core\frame.py", line 7359, in _arrays_to_mgr
    arrays = _homogenize(arrays, index, dtype)
  File "C:\Users\hp\Desktop\sentanalysis\newvenv\lib\site-packages\pandas\core\frame.py", line 7661, in _homogenize
    oindex = index.astype('O')
AttributeError: 'list' object has no attribute 'astype'

=======================================

for user in users_list:
    for frame in frames:
        # the if condition is satisfied only when the frame is the follower frame
        # this was necessary because the structure of the followers data was quite different
        # with the fact that the users of interest are in the 'follows' column. not the
        # the user column as in the other frames
        if 'follows' in frame.columns and frame['user'][0] != '_samcorfield':
            counts = frame[frame['follows'] == user]['labels'].value_counts()
        # not followers frame
        else:
            counts = frame[frame['user'] == user]['labels'].value_counts()
        labels = counts.index
        max_label = None

        for label in labels:
            if counts[label] == counts.max():
                max_label = label
                break
        if 'follows' in frame.columns:
            if frame['user'][0] == '_samcorfield':
                bag['follows_{}'.format(user)] = max_label
            else:
                bag['followers_{}'.format(user)] = max_label
        else:
            bag['user_{}'.format(user)] = max_label

index = 0
user_dict = {}

for user in users_list:
    user_dict[user] = {}

for key in bag.keys():
    for user in users_list:
        if key.startswith('follower'):
            user_dict[user]['followers'] = bag['followers_{}'.format(user)]
        elif key.startswith('follows'):
            user_dict[user]['follows'] = bag['follows_{}'.format(user)]
        elif key.startswith('user'):
            user_dict[user]['user'] = bag['user_{}'.format(user)]

# create the frame from the resulting dictionary
counts_data = DataFrame(user_dict, index=['user', 'followers', 'follows']).T
# this gets the series of the mode of the line for each user
# the mode becomes the user's resultant category.
counts_data['category'] = counts_data.T.mode().T

