Skip to content

Instantly share code, notes, and snippets.

View sanidhya-singh's full-sized avatar
🎯
Focusing

Sanidhya Pratap Singh sanidhya-singh

🎯
Focusing
View GitHub Profile
Key Description
image Name of the image to be used for the container
volumes Volume to be mounted for the container
restart Specify if the container should restart when the host machine restarts
enviroment Configure environment variables for the container (as supported by the image)
port Maps a port from the container to the host machine
Key Description
version Specifies what version of docker-compose to be used
services Names the containers in the app
volumes Mount a volume for your app
networks Specify a network to be used by the app
@sanidhya-singh
sanidhya-singh / melt.py
Created June 11, 2020 16:08
Python melt function
import pandas as pd
data = [["a", 11, 12, 13], ["b", 21, 22, 23]]
df = pd.DataFrame(data)
df.columns = ["company", "water", "elec", "rent"]
# display(df)
new_df = pd.melt(df, id_vars=['company'], value_vars=['water', 'elec', 'rent'])
new_df.columns = ["Company", "Bills", "Amount"]
display(new_df.sort_values(by=['Company']))
@sanidhya-singh
sanidhya-singh / example_output.json
Created January 9, 2020 04:56 — forked from simonw/example_output.json
Python function for retrieving all git commits (from "git log" in the current directory) as a useful data structure
[
{
"date": "Mon Jan 23 13:03:00 2017 -0800",
"message": "Recommended by Django https://docs.djangoproject.com/en/1.10/ref/databases/#setting-sql-mode",
"title": "SET sql_mode='STRICT_TRANS_TABLES';",
"hash": "a395f401c9a6d3e8602b80ecc729d736da871f46",
"author": "Simon Willison <simonw@example.com>"
},
{
"date": "Mon Jan 23 11:37:38 2017 -0800",