How modules know each other
<p>I can plot data from a CSV file with the following code:</p>

<pre><code>import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('test0.csv',delimiter='; ', engine='python')
df.plot(x='Column1', y='Column3')
plt.show()
</code></pre>

<p>But I don't understand one thing. How <code>plt.show()</code> knows about <code>df</code>? I'll make more sense to me seeing, somewhere, an expression like:</p>

<pre><code>plt = something(df)
</code></pre>

<p>I have to mention I'm just learning Python.</p>

<p>According to <a href="http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.show" rel="nofollow">http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.show</a> , the <code>plt.show()</code> itself doesn't know about the data, you need to pass the data as parameters.</p>

<p>What you are seeing should be the plot of pandas library, according to the usage <a href="http://pandas.pydata.org/pandas-docs/stable/visualization.html#basic-plotting-plot" rel="nofollow">http://pandas.pydata.org/pandas-docs/stable/visualization.html#basic-plotting-plot</a>.</p>

<p>Hope this solves your question.</p>

python python-2.7