Cleaning up date strings in Python
For starter, congratulations, the code is clean and uses rather good constructs. I just have two nitpicks about the layout:


I prefer to indent lists before the first row:

patterns = [
        # 0) 1-12-1963
        r'(\d{1,2})-(\d{1,2})-(\d{4})$',
        # 1) 1789-7-14
        r'(\d{4})-(\d{1,2})-(\d{1,2})$',
        # 2) '1945-2'
        r'(\d{4})-(\d{1,2})$',
        # 3) 2-1883
        r'(\d{1,2})-(\d{4})$',
]

PEP8 recommends two blank lines before top-level function definition.


You can also simplify the boilerplate of a try: … except Something: pass by using the contextlib.suppress context manager instead:

with suppress(ValueError):
    return str(int(date))


Lastly your pattern manipulation:


a match object can return all groups at once using its groups method, no need to special parse them;
you can unpack the groups tuple as arguments to format directly;
you can compile all your regexp beforehand instead of letting the regexp engine do it on-the-fly;
you should associate the output format string to each pattern to remove the need to search back which pattern matched and how it should be processed.


Proposed improvements:

import re
from contextlib import suppress


PATTERNS = [
        # 0) 1-12-1963 =&gt; 1963-12-01
        (re.compile(r'(\d{1,2})-(\d{1,2})-(\d{4})$'), '{2}-{1:0&gt;2}-{0:0&gt;2}'),
        # 1) 1789-7-14 =&gt; 1789-07-14
        (re.compile(r'(\d{4})-(\d{1,2})-(\d{1,2})$'), '{0}-{1:0&gt;2}-{2:0&gt;2}'),
        # 2) 1945-2 =&gt; 1945-02
        (re.compile(r'(\d{4})-(\d{1,2})$'), '{0}-{1:0&gt;2}'),
        # 3) 2-1883 =&gt; 1883-02
        (re.compile(r'(\d{1,2})-(\d{4})$'), '{1}-{0:0&gt;2}'),
]


def cleanup(date):
    with suppress(ValueError):
        return str(int(date))

    for pattern, formater in PATTERNS:
        match = pattern.match(date)
        if match is not None:
            return formater.format(*match.groups())
    return date


def main():
    dates = 1858.0, '1-12-1963', '1945-2', '7-2018', '1789-7-14',
    for date in dates:
        print(f'in: {date}, out: {cleanup(date)}')


if __name__ == '__main__':
    main()