I've been browsing everywhere to find answers on how to plot a pandas dataframe using sympy python but the results are still nil, even though here and here are available as learning materials, but I'm still a beginner, it's still difficult to get the output I want.
this is my code
from sympy.plotting import plot
import pandas as pd
from sympy import *
import numpy as np
x = symbols("x")
ekpr = x
data = {
"name": ["Lionel Messi", "Cristiano Ronaldo "],
"country": ["Argentina", "Portugal"]
}
df = pd.DataFrame(data,columns=["name","country"])
xvals1 = df.loc[0, "name"]
xvals2 = df.loc[0, "country"]
yvals1 = [ekpr.subs(x, xi) for xi in xvals1]
yvals2 = [ekpr.subs(x, xi) for xi in xvals2]
# add markers to the evaluated coordinates
markers = [{'args': [xvals1, yvals2, 'ro']}]
xvals2 = [(0, xi, xi) for xi in xvals1]
yvals2 = [(yi, yi, 0) for yi in yvals2]
# add these lines to the markers dictionary
for xv, yv in zip(xvals2, yvals2):
markers.append({'args': [xv, yv, 'r--']})
p = plot(ekpr, xlim=[0, 7], ylim= [0, 7], markers=markers)
I want (Lionel Messi, Argentina) connected to the x and y axes. Any help will be greatly appreciated.