Giter Site home page Giter Site logo

networkxd3's People

Contributors

januverma avatar maheshmurag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

networkxd3's Issues

Depricated Package: Fixed Code in the Comment

import networkx as nx 
from rpy2.robjects.packages import importr
import rpy2.robjects as ro
import pandas as p

from rpy2.robjects import pandas2ri
pandas2ri.activate()


def simpleNetworkx(G):
    ro.r('src = c()')
    ro.r('target =c()')
    ro.r('rdf=data.frame()')

    df = p.DataFrame(data=G.edges())
    df_r = pandas2ri.py2rpy(df)  # <------------- use py2rpy

    ro.globalenv['src'] = df_r[0]
    ro.globalenv['target'] = df_r[1]

    ro.r('rdf=data.frame(src,target)')

    utils = importr('utils')
    utils.chooseCRANmirror(ind=1)

    try:
        networkD3 = importr('networkD3')
    except:
        utils.install_packages('networkD3')
        networkD3 = importr('networkD3')

    try:
        magrittr = importr('magrittr')
    except:
        utils.install_packages('magrittr')
        magrittr = importr('magrittr')

    ro.r('''simpleNetwork(rdf) %>% saveNetwork(file = 'Net.html')''')
    return None`

Directory `Data/` missing ?

setup.py is mentioning data in Data/*.txt but the directory appears missing from the repository.

git add Data/*.txt before git commit and git push in the root directory of the original clone might be a way to fix this. An another way would be to remove Data/*.txt from setup.py.

NetworkxD3 issue

[Apologies in advance if it transpires that this issue is due to my newbie-ness.]

After installing NetworkxD3 as described and trying to run the MWE provided (see end), I get the following error: "NameError: name 'simpleNetworkx' is not defined"

Can you help? I am running Python 2.7.10.

Thanks,
Lisa


import networkx as nx
from NetworkxD3 import simpleNetworkx

G = nx.Graph()
H = ["A","B","C","D","E","F","G", "H","I","J"]
G.add_nodes_from(H)
G.add_edges_from([("A","B"), ("A","C"), ("A","D"), ("A","J"), ("B","E"), ("B","F"),
("C","G"),("C","H"), ("D","I")])

simpleNetworkx(G)

Unreadable Notebook

I tried to open NetworkxD3example.ipynb, but neither Github, nbviewer nor my local jupyter installation could handle it. Here's jupyter's error message:

Unreadable Notebook: /tmp/NetworkxD3/NetworkxD3example.ipynb NotJSONError('Notebook does not appear to be JSON: u\'{\\n "cells": [\\n {\\n "cell_type": "...',)

PandasError: DataFrame constructor not properly called!

I had to downgrade to Pandas 0.19.1 due to another error. Now I get the following error. Please provide the package versions you used:

import networkx as nx
from NetworkxD3.NetworkxD3 import simpleNetworkx
from IPython.display import IFrame 

G = nx.Graph()
H = ["A","B","C","D","E","F","G", "H","I","J"]
G.add_nodes_from(H)
G.add_edges_from([("A","B"), ("A","C"), ("A","D"), ("A","J"), ("B","E"), ("B","F"),
("C","G"),("C","H"), ("D","I")])

simpleNetworkx(G)
IFrame('Net.html', width=400, height=400)

PandasError Traceback (most recent call last)
in ()
9 ("C","G"),("C","H"), ("D","I")])
10
---> 11 simpleNetworkx(G)
12 IFrame('Net.html', width=400, height=400)

/vagrant/JMB/NetworkxD3/NetworkxD3/NetworkxD3.py in simpleNetworkx(G)
49 ro.r('rdf=data.frame()')
50
---> 51 df = p.DataFrame(G.edges())
52
53 df_r = com.convert_to_r_dataframe(df)

~/anaconda3/envs/normal/lib/python3.6/site-packages/pandas/core/frame.py in init(self, data, index, columns, dtype, copy)
343 copy=False)
344 else:
--> 345 raise PandasError('DataFrame constructor not properly called!')
346
347 NDFrame.init(self, mgr, fastpath=True)

PandasError: DataFrame constructor not properly called!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.