-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Change Jupyter display defaults:
pd.set_option('display.max_columns', 1000)
Reload a library in Python3.4 onwards:
import importlib
solveutils = importlib.reload(solveutils)
#importing from a different directory
import sys
sys.path.insert(0, "../libraries")
import solveutils
Drop all the duplicate rows (as in all copies of duplicates, including the originals) from a data frame: df[~df.duplicated(keep=False)]
Get the type of a column: dftweet['user'].apply(type)
#dump json to an output file
import json
with open('rawdata.json', 'w') as fout:
json.dump(rawdata, fout, ensure_ascii=False)
Sometimes you have to ask nicely for data (in this case, not adding headers got me a 403 error)
myheaders = {
'User-Agent': 'SJtest/1.0; +https://example.com',
'Accept': 'text/plain',
}
r = requests.get('https://100percentfedup.com/ads.txt',
headers=myheaders)
r
Metadata
Metadata
Assignees
Labels
No labels