I have some files .py, and I am executing them with python3.10 (microsoft store app), with that files i generate some csvs but I also want to save the prints output on a txt file and the sns graphics on pngs. So how can I do it?
That is an example from a file.py
dups_nom = df_users_data['X'].value_counts(dropna=False)
dups_nom_m = df_miembros_data['X'].value_counts(dropna=False)
X = []
for ind,val in dups_nom.items():
if val > 1:
X.append(ind)
if len(X):
print(f'There are {len(X)} X')
df_users_data[df_users_data.X.isin(X)]['X'].sort_values().to_csv('C:/.../.../X.csv',sep=';')
else:
print("There are not X")
print(dups_nom.head(len(X)))
g = sns.barplot(y=df.columns, x=df.isnull().sum(), orient = 'h')
for p in g.patches:
width = p.get_width()
plt.text(150+p.get_width(), p.get_y()+0.55*p.get_height(),width, ha='center', va='center')