I am currently trying to develop a convenience function, which is supposed to create for each column in a pandas dataframe a basic plot with the values and their amount in the dataset for all columns in the dataframe.
def plot_value_counts(df, leave_out):
# is supposed to create the subplots grid where I can add the plots
fig, axs = plt.subplots(int(len(df)/2) + 1,int(len(df)/2) + 1)
for idx, name in enumerate(list(df)):
if name == leave_out:
continue
else:
axs[idx] = df[name].value_counts().plot(kind="bar")
return fig, axs
this snippet runs for ever and never stops. I tried looking at other similar questions on stackoverflow, but couldn't find anything specific for my case.
the usage of the subplots function came from the following question: Is it possible to automatically generate multiple subplots in matplotlib?
below a short sample of the data file, so that everybody can understand the problem: https://gist.github.com/hentschelpatrick/e0a7e1400a4b5c356ec8b0e4952f8cc1#file-train-csv