I formed a dataset, where the two columns are edge lists taken from another dataset and I mistakenly formed one of the columns as an Int64Index type when extracting the indexes as pictured here
I am trying to extract the numbers from each cell, but run into problems. When I try to handle the number as a string using the int() command, I get an error that 'DataFrame' object is not callable. However when I try to use a pandas dataframe commmand, such as to_numeric(), I get a AttributeError: 'str' object has no attribute 'to_numeric'.
df1 = pd.DataFrame(np.array(["boo","foo","bar"]),columns=['col1'])
d = {'col1': ["boo","boo","boo","bar","foo","bar"], 'Title': ["no","yes","stop","yes","stop","go"],'Example': ["p","y","x","f","v","g"] }
df2 = pd.DataFrame(data=d)
d = {'Example': ["p","y","x","f","v","g"], 'Title': ["no","yes","stop","yes","stop","go"]}
df3 = pd.DataFrame(data=d)
for i in range(0,len(df1)):
val = df1['col1'][i]
stuff = df2[df2["col1"] == val]
stuff = stuff.reset_index()
for k in range(0,len(stuff)):
s = stuff["Example"][k]
p = stuff["Title"][k]
j = df2.index[(df2['Example'] == s) & (df2['Title'] == p)]
edges = edges.append({'source': i, 'target': j}, ignore_index=True)
m = edges['target'].tolist()[3]
print(m)
pattern = re.compile("[\d*]")
print(type("".join(pattern.findall(m)[2:-2])))
"".join(pattern.findall(m)[2:-2])
int("".join(pattern.findall(m)[2:-2]))