Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

Plotting Percentages in Pandas

$
0
0

@beau1 wrote:

Hello all, I’m stuck trying to plot percentages from the following code. The code works as is…but if I try to plot it, plt.bar or any other chart, I get an error.

SMS_noshow = df.groupby([“SMS_received”])
SMS_noshow=pd.crosstab(df[‘Gender’],df[‘SMS_received’]).apply(lambda r: r/r.sum(), axis=1)
SMS_noshow

I’m also hoping to adjust the following code to show the percentage of males and females that received a text message reminder but didn’t show up for an appointment. Again using the crosstab documentation from this page(https://pandas.pydata.org/pandas-docs/version/0.23.4/generated/pandas.crosstab.html), but even the percentages aren’t working on this one.

SMS_noshow=pd.crosstab(df[‘Gender’],df[“SMS_received, Noshow”]).apply(lambda r: r/r.sum(), axis=1)

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles