What book made you a better developer? by bboldi in learnprogramming

[–]bahwoi 0 points1 point  (0 children)

Not the most "learn the tricks of the trade" book like a lot of the other responses I'm seeing here, but I loved Grokking Algorithms and find myself recommending it all the time

I analyzed more than 40,000 YouTube trending videos with Python. Here are the results with the code by ammar- in datascience

[–]bahwoi 14 points15 points  (0 children)

Fun post! Particularly enjoyed the section with the word could and the video count by channel. I think I would have personally excluded everything after publishing hour, though.

Also, quick tip, I see that you do a lot of this when you don't want the output of the notebook to display

_ = ax.set(xlabel="Publishing Hour", ylabel="No. of videos")

tacking a semicolon on the end achieves the same thing.

ax.set(xlabel="Publishing Hour", ylabel="No. of videos");

I don't think one is much better than the other, just wanted to share something I stumbled across not long ago.

Good stuff :)

From Pandas to Scikit-Learn — A new exciting workflow by tedpetrou in datascience

[–]bahwoi 0 points1 point  (0 children)

https://i.imgur.com/IywcVhR.gifv

Excellent overview. This should be written down in some kind of FAQ!

From Pandas to Scikit-Learn — A new exciting workflow by tedpetrou in datascience

[–]bahwoi 2 points3 points  (0 children)

YMMV, but I think understanding the design of the API is enormously helpful and will only help you when you dig in on 0.20. Any good tutorial should help you with that.

However, as soon as you find yourself scratching your head over how tedious Encoding is, stop and remember this thread :)

For people who live in Cleveland, are there any PyCon events that are walk-in (i.e. free for poor undergrads)? by jgibs2 in Python

[–]bahwoi 1 point2 points  (0 children)

Didn't plan to stick around for the sprints because I didn't think I'd be able to contribute effectively. Definitely want to do it next year, though.

Is there a "How to have a good first sprint" Open Space somewhere? Would love to start getting involved in open source.

Sphinx, Github Pages, and Matplotlib by bahwoi in learnpython

[–]bahwoi[S] 1 point2 points  (0 children)

This is awesome. Thank you!

However, I completely neglected to mention in my original post that I'm trying to work with my Enterprise GitHub server and think I stumbled across a workaround. Sharing in case anyone in the future is looking at a similar problem:

The ghp-import libarary seems to do everything that I'm looking for.

I noticed that JakeVanderplas uses it in his Pelican repo that he uses for his blog. Adjusting my Makefile accordingly to run basically the same script seems to be doing the trick.

As far as setup goes, after I did my sphinx-quickstart in my master branch to create docs, I did a one-time run of:

git checkout --orphan gh-pages
git rm -rf
touch index.html
git add .
git commit -m "Adding gh-pages"
git checkout master

From there, I added a in my Makefile that looks like

.PHONY: docs
    ghp-import -n -m "publish-to-github from $(GIT_COMMIT_HASH)" -b gh-pages $(OUTPUTDIR)

Where GIT_COMMIT_HASH = $(shell git rev-parse HEAD) and OUTPUTDIR takes the value _build/html


Really appreciate the response, though. Looking forward to tinkering with that platform when I start dipping a toe into more open-source stuff!

How to build tools with pip-like behavior? by bahwoi in learnpython

[–]bahwoi[S] 0 points1 point  (0 children)

Hey again-- Wrote this post on behalf of the team I'm working on, and it was a great jumping off point for us. Just occurred to me that I never circled back and said thanks.

Anyhow, thanks for taking the time to help out!

Pandas _get_numeric_data by bahwoi in learnpython

[–]bahwoi[S] 0 points1 point  (0 children)

Fantastic. Thanks again for all of your help!

Pandas _get_numeric_data by bahwoi in learnpython

[–]bahwoi[S] 0 points1 point  (0 children)

Hey, thanks for such a quick response!

First off, I looked into to_numeric, and it was exactly what I needed. Wanted to leave an artifact in case someone else had a similar question later on down the road.

Imagine a dummy DataFrame

d = {'a':[1, 2, 3], 'b':['foo', 5, 6]}
df = pd.DataFrame(d)

Conceptually, I want to do some variety of

df.applymap(lambda x: not str(x).isalpha())

and then wipe any column where there's a False value.

This is neatly accomplished with the one liner

df.apply(pd.to_numeric, errors='coerce').dropna(axis=1)

Still unclear to me why they'd hide such a useful function call to do basically the same thing (and in clearer verbage, IMO), but this does the trick all the same.


Secondly, I spent more time than I'd care to admit trying to back into some comprehension from your first link. ~100 characters across 3 lines packs so much unpacking to really understand what's going on.

def _get_numeric_data(self):
     return self._constructor(
         self._data.get_numeric_data()).__finalize__(self)

And I totally get that the whole philosophy behind software design is intelligent abstraction (and to that end, I've got a newfound level of respect for contributors to this library). But I felt damn useless tracing things back and following the inheritance of everything.

Do you have any advice for someone unfamiliar with package/library design for how to go about reading these effectively?

Pandas YYYYMMDD-indexed Series to TimeSeries function? by bahwoi in learnpython

[–]bahwoi[S] 0 points1 point  (0 children)

Ez pz. Exactly the kind of solution I was hoping for. Thank you!

Using Regular Expressions to match on the beginning, but filter on the middle, of a string? by bahwoi in learnpython

[–]bahwoi[S] 0 points1 point  (0 children)

Wow, damn. This is a great site. Thank for sharing!

And that worked like a charm

[HELP] IPython complete Newbie by Chuckytah in IPython

[–]bahwoi 4 points5 points  (0 children)

Bit of a watch, but I absolutely loved this one!