0

I have looked at several other similar questions but their fixes are not working for me. I am running my script in a conda venv but I already installed pandas within said environment. I will show my code and the error I get when running from the terminal. Obviously, the directory of the virtual environment is not the same as the directory of my css file, which is why I give the file path to the file. I must add that within VS Code, I am able to get the data set and add items to the list I created (although the while loop is not currently working). Can anyone help?

import pandas as pd
import random


data_set = pd.read_csv("/Users/rickvillanueva/Documents/Myron/dated_random.csv")

random_data = data_set.MYRON_ACCT

random_names = []

random_gatherer = True
#Gathering random account numbers
while random_gatherer:
    one = random.choice(random_data)
    random_names.append(one)
    if len(random_names) < 50:
        random_gatherer = True
        continue
    else:
        break

len(random_names)
print(random_names)

Error I get in terminal:

Traceback (most recent call last):
  File "random.py", line 1, in <module>
    import pandas as pd
  File "/Users/rickvillanueva/opt/anaconda3/lib/python3.7/site-packages/pandas/__init__.py", line 11, in <module>
    __import__(dependency)
  File "/Users/rickvillanueva/opt/anaconda3/lib/python3.7/site-packages/numpy/__init__.py", line 152, in <module>
    from . import random
  File "/Users/rickvillanueva/opt/anaconda3/lib/python3.7/site-packages/numpy/random/__init__.py", line 181, in <module>
    from . import _pickle
  File "/Users/rickvillanueva/opt/anaconda3/lib/python3.7/site-packages/numpy/random/_pickle.py", line 1, in <module>
    from .mtrand import RandomState
  File "_bit_generator.pxd", line 14, in init numpy.random.mtrand
  File "_bit_generator.pyx", line 40, in init numpy.random._bit_generator
  File "/Users/rickvillanueva/opt/anaconda3/lib/python3.7/secrets.py", line 20, in <module>
    from random import SystemRandom
  File "/Users/rickvillanueva/Documents/Myron/random.py", line 5, in <module>
    data_set = pd.read_csv("/Users/rickvillanueva/Documents/Myron/dated_random.csv")
AttributeError: module 'pandas' has no attribute 'read_csv'

0 Answers0