Wednesday, December 28, 2016

"Groupby" got me crazy!

It took me days to understand the groupby for pandas. What I understood so far is that it sets the "grouped-by" column as the dataframe index unless the index is specified by a set_index command.


syntax: df.groupby('col1')

With this, you get to cut up your dataframe into smaller pieces for further processing. Groupby does the processing quicker (as tested with %time) compared to other types of slicing. Once sliced, you can use aggregate (.agg(dict{})) to further manipulate your data.

I am just trying to sound smart. Well...you'd be better off going here: http://pandas.pydata.org/pandas-docs/stable/groupby.html

Tuesday, December 20, 2016

running both 2.7 and 3.5 on windows

I finished some online courses for python 2.7 and grew quite comfortable with it. I save my scripts with a ".py" extension and call it from the dos prompt under the script's directory.

When I started the DataScience course, I had to move to python 3.5 but did not want to let 2.7 go. Most blogs advised to move and and just let go. But I didn't T_T.

So I kept both versions and installed them on the same machine. Both under c:\


rawr!


Scripts written on version 2.7 would run just fine when called from its current directory. For vesion 3.5, I add the line "#! C:\Python35\python.exe" at the very top so it can call python 3.5.

This works for me. Hope it does for you too!  

Monday, December 19, 2016

taking the first step

Earlier today I had an IM conversation with Lazam and tried to catch up on what's new. I mentioned that I have been busy with my DataScience class in Coursera (which I had to extend....twice!...due to tough assignments!) and gave me job postings and references for DataScience jobs. The posts require at least 2 years of professional python geek experience...which of course I don't have (yet!). I mentioned that I wanted to get a home-based part-time python job first or materialize a python project to make my CV look good. Well...I have not initiated any of those...hohohoho... so Lazam suggested to contribute in github or start a blog...well..starting a blog is the easiest of the choices...and viola! PYNOOB is born!

To start of, let me share my dice script because python! LOL
(py v2.7)

pubpy/dice.py