Ni! Hi ashu,

Please, always try to *read errors carefully* and consult the documentation. Not to mention, provide self-contained examples.

Python is throwing a "TypeError" and telling you it expects an integer ('unsigned long', the C++ type for vertex indices) while you are passing it a string ('str').

As you can see in the documentation, if you want to pass strings to add_edge_list you should set two additional arguments: `hash=True` and `string_vals=True`.

If that doesn't fix it, you'll have to provide a self-contained example where the error occurs, otherwise we can't really help.

.~´



On Wed, Jul 18, 2018 at 9:37 AM, ashutosh <ashuein@gmail.com> wrote:
Hi,

I'm trying to convert two columns of my pandas dataframe into network using
them as edge list.
A  similar query
<https://stackoverflow.com/questions/35459597/graph-tool-reading-edge-lists-from-pandas-dataframe
was posted in StackOverflow but with different problem and it didn't help
me.

When I am trying the following code it gives me error:
*
myGraph.add_edge_list(i for i in df[['node1','node2']].values.tolist())*

Where, my Graph is the graph;  df is the dataframe with 4 columns out of
which I am using two 'node1' and 'node2'.

*File "/usr/lib/python3/dist-packages/graph_tool/__init__.py", line 2109, in
add_edge_list
    libcore.add_edge_list_iter(self.__graph, edge_list, eprops)*

*TypeError: No registered converter was able to produce a C++ rvalue of type
unsigned long from this Python object of type str
*


I tried upgrading my boost library but it doesn't solve the problem. Any
suggestions ?



--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/
_______________________________________________
graph-tool mailing list
graph-tool@skewed.de
https://lists.skewed.de/mailman/listinfo/graph-tool