semvec/pypi-packages huggingface dataset:
datedetect 1.0.0
Get possible string format codes of the given datetime object.
Requires Python: >=3.6

# datedetect

Get possible string format codes of the given datetime object.

Supports Python 3.6+.

````python
>>> import datedetect

>>> datedetect.get_format_codes("1997-11-04 12:00:00.123456+5:30")
['%Y-%m-%d %H:%M:%S.%f%z']

>>> datedetect.get_format_codes(["1997-11-04 12:00:00.123456+5:30"], verbose=True)
# verbose True for display name and count of matches
[{'format': '%Y-%m-%d %H:%M:%S.%f%z', 'display_name': 'yyyy-MM-dd HH:mm:ss.ffffffzzz', 'count': 1}]

>>> datedetect.get_format_codes(["10-10-2019", "10-12-2019", "21-1-2019"], verbose=True)
# first date can be both dd-MM-yyyy, MM-dd-yyyy, d-M-yyyy, M-d-yyyy
# second date be dd-MM-yyyy d-M-yyyy MM-dd-yyyy M-d-yyyy
# third date is d-M-yyyy
[{'format': '%-d-%-m-%Y', 'display_name': 'd-M-yyyy', 'count': 3},
 {'format': '%d-%m-%Y', 'display_name': 'dd-MM-yyyy', 'count': 2},
 {'format': '%m-%d-%Y', 'display_name': 'MM-dd-yyyy', 'count': 2},
 {'format': '%-m-%-d-%Y', 'display_name': 'M-d-yyyy', 'count': 2}]
````
nonlinshrink 0.7
Non-Linear Shrinkage Estimator from Ledoit and Wolf (2018)

# Non-Linear Shrinkage
Provides a function that calculates an estimate of the covariance matrix shrunk using a non-linear analytic formula provided by
the working paper Ledoit and Wolf (2018), entitled ['Analytical Nonlinear Shrinkage of Large-Dimensional Covariance Matrices']
(http://www.econ.uzh.ch/static/wp/econwp264.pdf).


# Installation
```
pip install nonlinshrink
```

# Usage
```
import numpy as np
import nonlinshrink as nls
p = 2
n = 13
sigma = np.eye(p, p)
data = np.random.multivariate_normal(np.zeros(p), sigma, n)
sigma_tilde = nls.shrink_cov(data)
```
The data is automatically demeaned unless otherwise specified. In the case where the data has been pre-processed and the effective degrees of freedom of the dataset is decreased, e.g. through an OLS regression, the user can specify this through a parameter `k` which signifies the degrees of freedom already subtracted. For example,
```
import numpy as np
import nonlinshrink as nls
p = 2
n = 14
sigma = np.eye(p, p)
data = np.random.multivariate_normal(np.zeros(p), sigma, n) + np.arange(n)[:, np.newaxis] + 1
x = np.vstack((np.ones(n).T, np.arange(n).T)).T
betahat = np.linalg.solve(np.dot(x.T, x), np.dot(x.T, data))
datahat = np.dot(x, betahat)
res = data - datahat
sigma_tilde = nls.shrink_cov(res, k=2)  # corresponding to 2 degrees of freedom
```
# Developing
Please submit a PR! The shrinkage function itself is located in `nonlinshrink.py`. 
For running the tests do 
```
git clone https://github.com/matzhaugen/analytic_shrinkage.git
cd analytic_shrinkage
pip install -e . # install the package
pytest
```
dcggraph 0.0.9
Directed Cyclic Graph Utilities for Python
Requires Python: >=3.6
Keywords: directed cyclic graph traversal

Directed Cyclic Graph Utilities for Python
==========================================

installing
----------
```pip install dcggraph```

description
-----------
This package currently used for doing predicated searches from a given
node in a directed graph that is allowed to be cyclic. Some points to clear
up confusion:
- __directed__: means an edge between 2 nodes can only be travelled in one
  direction _(although there can be two edges going opposite directions between the same two nodes)
- __predicated__: means that even if a node is reachable, it still has to
  pass a prediate test (i.e. `predicate(node) == True`) in order to be
  returned.
    - this means there are really 2 search filters in the graph:
        1) the node has to be reachable without any filtering
        2) the node has to pass the predicate test
- __cyclic__: means that if you start from a node, and follow a bunch of
  paths, you can end up at the same node. This makes things a lot harder
  than if you were working with DAGs.

cycles are tricky
-----------------
The main trick used to deal with cycles is having the predicate return 3 states:
  1) `PASS`: means the node confidently passes the predicate
  2) `FAIL`: means the node confidently fails the predicate
  3) `WAIT`: means the node is unsure if it passes yet, and would like to defer giving a
     confident answer until more nodes are seen (since starting point matters in cyclical graphs)

Nodes that return the `WAIT` state from a predicate get put in the `unresolved` list, and are re-evaluated every time another node returns `PASS` or `FAIL`.  After all reachable nodes have been evaluated, any remaining nodes in the `unresolved` list are demoted to the `FAIL` state, since they couldn't make up their mind, and there are no more chances for them to give a real answer.

This algorithm seems to work well for the cases I use predicated searches in a graph. I'm __positive__ better algorithms exist than what is implemented here.

API
---
The main feature is predicated graph compression and search. 
In addition to the snippet below, look at the tests for example usage
```python
import re
from dcggraph import DCGnode, DCGedge, DCGgraph
from dcggraph.search import PredicateResult, DCGsearch

g = DCGgraph()
n0 = g.create_node("n0")
n1 = g.create_node("n1")
n2 = g.create_node("n2")
n3 = g.create_node("n3")
n4 = g.create_node("n4")
g.create_edge(n0, n1)
g.create_edge(n0, n2)
g.create_edge(n1, n3)
g.create_edge(n1, n4)

def even(node, visited, passed, failed):
   if f re.match("[a-z][02468]", node.name):
       return PredicateResult.PASS
   else:
       return PredicateResult.FAIL

s1 = DCGsearch(g, even)

# reuse the search object to cache FAIL/PASS results between searches
assertEqual(len(s1.search(n0)), 3)
assertEqual(len(s1.search(n1)), 1)
assertEqual(len(s1.search(n2)), 1)
assertEqual(len(s1.search(n3)), 0)
assertEqual(len(s1.search(n4)), 1)

```