Skip to content

Instantly share code, notes, and snippets.

View jmquintana79's full-sized avatar
💭
I may be slow to respond.

Juan Quintana jmquintana79

💭
I may be slow to respond.
View GitHub Profile
@natelandau
natelandau / .bash_profile
Last active November 10, 2024 21:53
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@jmquintana79
jmquintana79 / create_pandasdf.py
Last active December 13, 2020 20:41
create pandas dataframe
import numpy as np
import pandas as pd
# alternative faster: Pandas on Ray
import ray.dataframe as pd
## ONE NUMPY ARRAY TO PANDAS DATAFRAME
# data
ldata = [[1,2],[7,3]]
# list of list to numpy array
@jmquintana79
jmquintana79 / features_matplotlib.py
Last active July 18, 2022 14:18
Main features of matplotlib library
# import modules and tools
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
# SOURCE OF COLOURS: http://matplotlib.org/examples/color/named_colors.html
from matplotlib import colors as mcolors
lname_colors = mcolors.cnames.keys()
# create objects
fig, ax = plt.subplots()
@jmquintana79
jmquintana79 / filtering_pandas.py
Last active January 22, 2022 00:04
Filter data stored into pandas dataframe
""" Filter by condition """
# conditional operators for pandas:
# EQUAL: ==
# DIFFERENT TO: !=
# BIGGER THAN: >
# LOWER THAN: <
# BIGGER OR EQUAL TO: >=
# LOWER OR EQUEAL TO: <=
# AND: &
# OR: |
@jmquintana79
jmquintana79 / plot_pandas.py
Last active July 29, 2020 11:12
Plot with pandas df quickly
# Homepage: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.plot.html
import pandas as pd
import matplotlib.pyplot as plt
# plot
DF.plot(x='year', y=['var1', 'var2'],kind="line",subplots=False,layout=(2,2))
# layout: distribution of multicharts.
# subplots: plot each line in different charts.