The New York Stock Exchange (NYSE) historical records contain multiple, absurdly novice errors. It's dirty data, referring to days that don't exist, and giving multiple inconsistent answers for over a month of trading days. And this is the data set of record, from the world's leading financial
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
""" | |
Demonstration of an "overwriteable file proxy." It appears you are | |
reading from, processing, and updating a file. In reality, writes are | |
driven to a temporary file which is then renamed to the 'original' | |
name. `OverWriter` proxies can be used stand-alone, or as a context | |
manager in a `with` statement. | |
""" | |
import re | |
import os |
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
import benchmark | |
s = '16122.83' | |
class Options(benchmark.Benchmark): | |
each = 1000 |
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
import contextlib | |
import sys | |
from StringIO import StringIO | |
# Output capturing helpers thanks to | |
# test.test_support and http://stackoverflow.com/a/18844643/240490 | |
# extended by Jonathan Eunice to add easy saving to a file (including | |
# auto-save if a filepath is provided in the constructor) | |
# This is not quite polished enough to make it into a full PyPI |
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
from random import choice, randint | |
import string | |
import time | |
import sys | |
_PY3 = sys.version_info[0] == 3 |
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
from itertools import * | |
def groups_of_n(iterable, n): | |
""" | |
Collect data into fixed-length chunks or blocks. Generates (yields) | |
a sequence of iterators. Useful for segmenting very large sequences | |
into more manageable chunks. If the final chunk is of less than size n, | |
no worries. It will return what there is. NB This is *much* more |
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
/** | |
* CSS imperative declarations. | |
* E.g. cssi('div#one.two.three') | |
* yields { element: 'div', | |
* id: 'one', | |
* class: 'two three', | |
* } | |
* Classes are not split out into an array |
And now some obligatory self-promotion:
I've completed over 350 successful Codementor sessions, with [top-notch reviews][1].
I've contributed to the core Python project (CPython), have many published Python modules, and have completed many Python challenge problems at sites like HackerRank:
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
from typing import Dict, List, Union | |
ValueType = Union[str, int, List[str]] | |
order_data: Dict[str, ValueType] = { | |
'one': 1, | |
'two': 'two', | |
'many': ['this', 'is', 'many', 'strings'], | |
'keywords': ["test_1", "test_2"] | |
} |
OlderNewer