Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
(learn 'model)

Damien Garaud garaud

🚀
(learn 'model)
View GitHub Profile
@garaud
garaud / rank-by-date.py
Last active May 31, 2017
Rank some elements by ascending date
View rank-by-date.py
# coding: utf-8
"""rank by ascending date
"""
from datetime import date
from faker import Factory
import pandas as pd
@garaud
garaud / clojurenews-email-digest.py
Last active Jan 4, 2017
Simple snippet to get the latest entries from the MongoDB ClojureNews data in order to send a weekly digest email
View clojurenews-email-digest.py
# -*- coding: utf-8 -*-
from datetime import datetime
from dateutil.relativedelta import relativedelta
import pymongo
from pymongo import MongoClient
from jinja2 import Template
@garaud
garaud / sqlalchemy-orm-query-to-dataframe.py
Last active Jul 9, 2021
Example to turn your SQLAlchemy Query result object to a pandas DataFrame
View sqlalchemy-orm-query-to-dataframe.py
# -*- coding: utf-8 -*-
"""From a Query.all(), turn this result to a pandas DataFrame
Table creation and example data come from the official SQLAlchemy ORM
tutorial at http://docs.sqlalchemy.org/en/latest/orm/tutorial.html
Just take a look at the 'query_to_dict' function and the last part of the __main__.
"""
@garaud
garaud / pandas-plotting-with-highcharts.ipynb
Last active Aug 29, 2015
Pandas DataFrame plotting with Highcharts
View pandas-plotting-with-highcharts.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@garaud
garaud / Brownian-motion-pandas.ipynb
Last active Aug 29, 2015
Brownian Motion IPython notebook with pandas
View Brownian-motion-pandas.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@garaud
garaud / getmodulepath.py
Created Dec 16, 2014
Get the file path of a class, function or Python module as pydoc and open it into your editor
View getmodulepath.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Damien Garaud
# Date: 2014
# License: Simplified BSD
"""Open a Python module in you editor when you're looking for a class, function
or module name.
@garaud
garaud / pipe-to-emacs.py
Last active Mar 20, 2021
Pipe to Emacs: Insert a result from an UNIX command into a new Emacs buffer
View pipe-to-emacs.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Damien Garaud
# Date: 2014-2015
# License: Simplified BSD
"""Allow you to pipe command results into an Emacs buffer. Suppose you have an
Emacs server since you launch 'emacsclient'.