Python Day 1:
Neuron Network Graph
Suppose we would like to build a basic network graph implies a student’s grade is affected by IQ and Study. In addition, Interest and method affect the result of the study.# libraries
import pandas as pd
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
#build dataframe with connections:
df = pd.DataFrame({ 'from':['Grade', 'Study', "Interest", "Method", 'Grade'], 'to':['IQ', 'Grade',"Study", "Study", 'Study']})
print(df)
# Build your graph
G=nx.from_pandas_dataframe(df, 'from', 'to')
# Plot it
nx.draw(G, with_labels=True)
plt.show()
inspired by https://python-graph-gallery.com/320-basic-network-from-pandas-data-frame/
Happy Studying
!