Skip to content

Instantly share code, notes, and snippets.

View sarchak's full-sized avatar

Shrikar Archak sarchak

View GitHub Profile
@sarchak
sarchak / fetch_data.py
Created July 6, 2017 05:24
Fetch Data from reddit
import praw
import os
import pymongo
from pymongo import MongoClient
client = MongoClient()
db = client.redditdb
submissions = db.submissions
comments = db.comments
reddit = praw.Reddit(client_id=os.environ.get('REDDIT_CLIENT_ID'),
@sarchak
sarchak / sample.csv
Created July 12, 2017 05:19
Sample data
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 9 columns, instead of 3. in line 5.
goal,disable_communication,country_int,currency_int,duration,days_status_changed,backers_count,cleaned_text,final_status
20.0,False,10,8,8,0,3,drawing for dollars i like drawing pictures and then i color them too so i thought i would suggest something for me to draw and then if someone wants drawing for dollars,1
300.0,False,10,8,16,0,2,sponsor dereck blackburn lostwars artist in residence in kankakee illinois i dereck blackburn will be taking upon an incredible journey in the month of may 2009 i will be traveling to my hometown of kankakee sponsor dereck blackburn lostwars artist in residence in kankakee illinois,0
30.0,False,10,8,9,0,0,mr squiggles so i saw darkponys successfully funded drawing for dollars project and i thought thats fun i drew this guy who im calling mr squiggles,0
500.0,False,10,8,29,0,18,"help me write my second novel do your part to help out starving artists and help me write my second novel
i have just finished writing my first novel and help me write my second novel",1
2000.0,False,1
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
We can't make this file beautiful and searchable because it's too large.
"carat","cut","color","clarity","depth","table","price","x","y","z"
0.23,"Ideal","E","SI2",61.5,55,326,3.95,3.98,2.43
0.21,"Premium","E","SI1",59.8,61,326,3.89,3.84,2.31
0.23,"Good","E","VS1",56.9,65,327,4.05,4.07,2.31
0.29,"Premium","I","VS2",62.4,58,334,4.2,4.23,2.63
0.31,"Good","J","SI2",63.3,58,335,4.34,4.35,2.75
0.24,"Very Good","J","VVS2",62.8,57,336,3.94,3.96,2.48
0.24,"Very Good","I","VVS1",62.3,57,336,3.95,3.98,2.47
0.26,"Very Good","H","SI1",61.9,55,337,4.07,4.11,2.53
0.22,"Fair","E","VS2",65.1,61,337,3.87,3.78,2.49
We can't make this file beautiful and searchable because it's too large.
post,tags
conventions of importing python main programs often i write command line utilities that are only meant to be run as main. for example i might have a file that looks like this: <pre><code>#!/usr/bin/env python if __name__ == __main__ : import sys # do stuff </code></pre> in other words there is nothing going on that isn t under the if statement checking that this file is being run as main. i tried importing a file like this to see what would happen and the import was successful. so as i expected one is allowed to import files like this but what is the convention surrounding this practice is one supposed to throw an error telling the user that there is nothing to be imported or if all the contents of the file are supposed to be run as main does one need to check if the program is being run as main or is the conditional not necessary also if i have import statements should they be at the top of the file or under the conditional if the modules are only being used unde
This file has been truncated, but you can view the full file.
rid aid overall
176008 0 5.0
173739 0 1.0
134504 0 3.0
24476 0 2.0
57419 0 1.0
79045 1 5.0
86474 1 2.0
157218 1 5.0
162834 1 4.0
We can't make this file beautiful and searchable because it's too large.
rid aid overall
176008 0 5.0
173739 0 1.0
134504 0 3.0
24476 0 2.0
57419 0 1.0
79045 1 5.0
86474 1 2.0
157218 1 5.0
162834 1 4.0
We can't make this file beautiful and searchable because it's too large.
rid,aid,overall
176008,0,5.0
173739,0,1.0
134504,0,3.0
24476,0,2.0
57419,0,1.0
79045,1,5.0
86474,1,2.0
157218,1,5.0
162834,1,4.0