I am trying to assign reviewers to projects with the condition that the author of the project cannot be assigned as a reviewer to a project in their own portfolio.
I created a dataset with variables named project and portfolio. I have an array with the names of the individuals.
Please be kind, as I am learning Python on my own on the job, using Jupyter Notebook, python 3. I copied this code from other places and put it together. I have been at this all day. My superior wants error free code by the end of the week. I am desperate!!!
Here is the code that I have so far:
!pip install pandas
dir_path = "path/to/filename.csv"
import pandas as pd
df = pd.read_csv(dir_path,index_col=0)
df.head
import random
random.seed(25, 2) #sets the first random number for reproducibility
random.randint(100, 250) #random integer 100 to 250
Update 1 (works, thanks Ken!):
import pandas as pd
# Load dataframe
df = pd.read_csv(dir_path, index_col = 0)
first = df["portfolio"]
print(first)
Update2 # Select 6 random projects for Moi which are not "XXX"
#random dataframe
import numpy as py
df2 = pd.read_csv(dir_path, skiprows=1)
np.random.seed(100)
df2 = pd.DataFrame(np.random.randint(10, size=(6,2)), columns=list('project portfolio') if ((portfolio == "XYZ") or (portfolio == "ABC") or (portfolio == "MKZ") or (portfolio == "BNZ"))
print (df2)
Error message
File "<ipython-input-29-0ee5224a45db>", line 7
print (df2)
^
SyntaxError: invalid syntax
I daresay this is a simple mistake.