Hi! When I was doing the second guided project: Hacker News, I tried to separate “Ask HN” and “Show HN” rows to different lists. But when I printed the lengths of these lists, the numbers are 0. I’m not sure if its because of the dataset or other problems. I downloaded the dataset from Kaggle.
Here is the code file:
Exploring Hacker News Posts.ipynb (4.6 KB)
Here is my code:
ask_posts = []
show_posts = []
other_posts = []
for row in hn:
title = hn[1]
if title.lower().startswith('ask hn'):
ask_posts.append(row)
elif title.lower().startswith('show hn'):
show_posts.append(row)
else:
other_posts.append(row)
print(len(ask_posts))
print(len(show_posts))
print(len(other_posts))
Thank you!