简体   繁体   中英

failed to networkx: SyntaxError: positional argument follows keyword argument

import numpy as np
import networkx as nx
import matplotlib.pyplot as plt


G = nx.DiGraph()

for d in pd.read_csv("politwi.csv",sep='\s+',"shift-jis", header=None, 
names=['A', 'B'], chunksize=10000,):
    G.add_edges_from([tuple(x) for x in d.values])

for e in G.edges():
    print 



pos = nx.spring_layout(G,scale=1)
nx.draw(G,pos, with_labels=True)
plt.savefig('this.png')
plt.show() 


errorcode:
File "<ipython-input-21-4a0f4e4a5667>", line 8
    for d in pd.read_csv("politwi.csv",sep='\s+',"shift-jis", header=None, 
names=['A', 'B'], chunksize=10000,):
                                            ^
this is my code I try to above,
  1. this is the code I tried above, but below is the errors

    SyntaxError: positional argument follows keyword argument

  2. first i tried to collect tweet from twitter and write it into csv by using this csv, designing wordcloud and networkx. but i failed to make the networkx

my question is what kind of error? and how to slove it? i am learning python by myself. I might not have some important resource about python so please tell me in detail answer as much as you can

在这里,您有一个逗号sep='\\s+',"shift-jis" ,在'\\s+'"shift-jis" ,需要一起删除逗号,但是如果"shift-jis"是一个单独的参数放在sep='\\s+' ,也可以在chunksize=10000之后删除逗号

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM