Created
July 24, 2018 20:50
-
-
Save oxidizeddreams/7b49414c8f475d5295fb31b343f7c7bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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