擅长:python、mysql、java
<p>假设要使用给定行中的信息绘制单个点:</p>
<ol>
<li>使用水果名称选择行,这将返回一个pd系列在</li>
<li>在结果上调用方法图</li>
</ol>
<p>例如:</p>
<pre><code>import pandas as pd
import matplotlib.pyplot as plt
# Create the data frame
mydata = pd.DataFrame({
'name': ['banana', 'mango', 'lima', 'apple'],
'weight': [1, 2, 3, 4]})
# Select the fruit you want to plot. This will return a pd.Series
# including the colums 'name' and 'weight'
to_plot = mydata[mydata['name'] == 'banana']
# Call the plot function indicating the which column X and Y axis.
fig, ax = plt.subplots()
to_plot.plot(x='name', y='weight', marker='o', ax=ax)
ax.set_ylabel('Weight')
</code></pre>