Privacy Policy

Not only Theory

I received some negative feedback on my last post on the Italian blog uomodellamansarda.com, from Filippo and Francesco, two dear friends and I am planning a dinner to discuss better their suggestions.
A bbq, a bottle of wine(actually I would try this non-commercial-vermouth –> https://amzn.to/2v0oles ) , a friendly discussion and I hope on this occasion to learn how to make a great Negroni, also.
But this is another story! I want to talk about something else!

I want to talk about the dichotomy between practice and theory.
Only theory is not enough, this is true for physicians as for other professions, practice is needed.
But practice needs theory to refine the technique.
I guess that you never want surgery from a physician that studied everything on the book but He hasn’t practical experience, likewise, you never want surgery from a trainee doctor without a theoretical foundation

I tend to be stronlgy theoretical , I study often a problem from all its point of view before coming to a solution and this tendency could be extremely negative if you not compensate through some practice.
This is especially true with Python.

“Theory is when you know everything but nothing works. Practice is when everything works but no one knows why. We combined theory and practice: nothing works and no one knows why”-Albert Einstein *

During the following week I will allocate, at least, 20h to dedicate to Python and the error I could do is to hit the books or online courses and focusing too much on theory.
To avoid this error I created some activity labels on my Clockwork Pomodoro.
This labels are crunched by a small script that receives as input the information on how I used my time in the last week and It gives back the percentage of accomplishment, based on the mix between Practice, Theory and Writing about the Progresses made.
In short:

  • Working 10 h
  • Studying 6 h
  • Marketing 4h

The script is raw and I will improve it, I could use some “for” loops to make it more readable (I appreciate in advance for any feedback on what I could enhace and improve)

The first part of the script keeps me updated on how is going my practice with Python, I wrote in the past about this script on this blog, the second part of the script evaluates the “mix”

Thanks for reading the article, big hug.

Andrea
ps If you notice any mistake ping me, if you liked share it! 🙂
In [2]:
import pandas as pd 
import matplotlib.pyplot as plt
import numpy as np
from datetime import datetime, timedelta


va='Python'
tvoi='Length'

csvname="logs2.csv"
#read the csv	
columns_name=['Year', 'Month', 'Day', 'Time', 'Length', 'Start', 'End', 'Activity']
dfraw=pd.read_csv(csvname,names=columns_name,sep=',',skiprows=1,skipfooter=0, index_col=False)


dfraw[tvoi] = dfraw[tvoi].astype('str')
mask = (dfraw[tvoi].str.len() == 6) 
dfraw = dfraw.loc[mask]

dfraw[tvoi]=dfraw[tvoi].str.strip()

dfraw[tvoi]=pd.to_datetime(dfraw[tvoi], format='%M:%S')
dfraw['Date'] = dfraw.apply(lambda row: datetime(row['Year'], row['Month'], row['Day']), axis=1)


pythondf=dfraw[(dfraw['Activity'].str.contains("Python",na=False)) | (dfraw['Activity'].str.contains("python",na=False))] 
numacti=pythondf.groupby('Date').count()
numacti=numacti['Activity']
numacti=numacti.divide(2)
cumulata=numacti.cumsum()


day=pd.concat([numacti, cumulata], axis=1)
day.columns=['pgiorno','cumulata']
maxh=cumulata.max()
plt.plot(day.index,day['cumulata'])
plt.xticks(rotation=90)
plt.title('Totale ore di studio e lavoro con Python (%d ore)' %(maxh))
plt.tight_layout()
plt.show()
In [26]:
#Section for weekly analysis
python_work=10
python_study=6
sutdy='study'
marketing='marketing'

python_marketing=4
total=python_work+python_study+python_marketing

#Selection only the last 7 days of the log 
days=7
cutoff_date= pythondf['Date'].iloc[-1]- pd.Timedelta(days=days)
print(cutoff_date)
last_7days= pythondf[pythondf['Date'] > cutoff_date] 
#Qualsiasi attivita' che non abbia come label "marketing" o "study" "datacamp" "ripasso" "libro" é considerata "work"
#Per del codice migliore cercherò nei prossimi log di avere solo tre label study work marketing come metag
study_mask=(last_7days['Activity'].str.contains("ripasso",na=False) | last_7days['Activity'].str.contains("datacamp",na=False)) | (last_7days['Activity'].str.contains("Libro",na=False))
pythondf_study=last_7days[study_mask]

pythondf_marketing=last_7days[last_7days['Activity'].str.contains("marketing",na=False)]


pythondf_work=last_7days[~study_mask]

#Pomodoro Time Slots last 30 minutes(25+5)
#We have to group by category and then count
#Not enough lazy for a foor loops, sorry

print("Weekly % of Python Working",round(pythondf_work['Activity'].count()/2/python_work*100,2))
print("Weekly % of Python Study", round(pythondf_study['Activity'].count()/2/python_study*100,2))
print("Weekly % of Python Marketng",round(pythondf_marketing['Activity'].count()/2/python_marketing*100,2))
2018-07-18 00:00:00
Weekly % of Python Working 95.0
Weekly % of Python Study 50.0
Weekly % of Python Marketng 62.5

*quote to be verified

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.