summaryrefslogtreecommitdiff
path: root/networkx/convert_matrix.py
diff options
context:
space:
mode:
authorthegreathippo <thegreathippo@gmail.com>2016-05-01 11:39:51 -0400
committerthegreathippo <thegreathippo@gmail.com>2016-05-01 11:39:51 -0400
commitbf54ac6dd5792b3d39f149ed93f4ccc6a7148535 (patch)
treed73005ef194a43771a8ba6ef69d111973b05e9bb /networkx/convert_matrix.py
parente24eb6ca984309248619b379bb473ce25fd245ea (diff)
downloadnetworkx-bf54ac6dd5792b3d39f149ed93f4ccc6a7148535.tar.gz
Update add_edge calls to use update for edge attributes.
Since convert and convert_matrix both might be called upon to convert graphs with non-string attributes, it was necessary to modify the code so that the edge attributes are updated via the dict's built-in update rather than simply passing the values as keyword arguments.
Diffstat (limited to 'networkx/convert_matrix.py')
-rw-r--r--networkx/convert_matrix.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/networkx/convert_matrix.py b/networkx/convert_matrix.py
index 612a7aee..dc119714 100644
--- a/networkx/convert_matrix.py
+++ b/networkx/convert_matrix.py
@@ -210,7 +210,8 @@ def from_pandas_dataframe(df, source, target, edge_attr=None,
# Iteration on values returns the rows as Numpy arrays
for row in df.values:
- g.add_edge(row[src_i], row[tar_i], **{i:row[j] for i, j in edge_i})
+ g.add_edge(row[src_i], row[tar_i])
+ g[row[src_i]][row[tar_i]].update((i, row[j]) for i, j in edge_i)
# If no column names are given, then just return the edges.
else: