Skip to content

Instantly share code, notes, and snippets.

@oxidizeddreams
Created July 24, 2018 20:50
Show Gist options
  • Save oxidizeddreams/7b49414c8f475d5295fb31b343f7c7bf to your computer and use it in GitHub Desktop.
Save oxidizeddreams/7b49414c8f475d5295fb31b343f7c7bf to your computer and use it in GitHub Desktop.
# useful debugging on console
>>> import os
>>> os.environ['TDSDUMP'] = 'stdout'
>>>
>>> import pymssql
>>> conn = pymssql.connect(server="sqlserverhost")
# py3-extended unpacking
a, *b, c = [1, 2, 3, 4, 5]
a, b = function
In [1]: data = 'col1,col2,col3\na,b,1\na,b,2\nc,d,3'
In [2]: pd.read_csv(StringIO(data))
Out[2]:
col1 col2 col3
0 a b 1
1 a b 2
2 c d 3
In [3]: pd.read_csv(StringIO(data), usecols=lambda x: x.upper() in ['COL1', 'COL3'])
Out[3]:
col1 col3
0 a 1
1 a 2
2 c 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment