how can I plot column A as x-axis and B as y-axis with data only related to C. looking for a graph that looks like density graph.
1 Answer
If you are having error while extracting specific columns then, it might be because of extra spaces, just try removing extra space.
Here is code:
usa = df[df.Country == 'USA']
usa.columns = usa.columns.to_series().apply(lambda x: x.strip())
usa[['Score', 'Profit']]
For Density Graph, the question is still unclear, but here density plot based on what I have understood
import seaborn as sns
p=sns.kdeplot(usa['Score'], shade=True, color="r")
p=sns.kdeplot(usa['Profit'], shade=True, color="b")
2 Comments
qhfalice
thank you! for second question, I was wondering if there is any plot that I can choose both x and y axis but still looks similar to the density graph (smooth line, not line graph)
Malvi Patel
Link Do have a look at this question, is this what you are looking for

usa = df[df.Country == 'USA']selects a subset of rows in the dataframe. To select a subset of columns, such as score & profit, try:usa[['score', 'profit']].