Skip to content

Instantly share code, notes, and snippets.

@lettergram
Created January 30, 2018 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lettergram/3b408a50ef403668b0c8c48514409a72 to your computer and use it in GitHub Desktop.
Save lettergram/3b408a50ef403668b0c8c48514409a72 to your computer and use it in GitHub Desktop.
Resamples dataframe example for https://blog.projectpiglet.com
import pandas as pd
import scipy.stats as ss
from scipy import signal
# Outer Join, Fill NaN
combined_df = first_df.join(second_df, how='outer').fillna(method='ffill').fillna(0.0)
# Resample first_df and second_df to be the same size
combiend_df[col1] = ss.zscore(signal.resample(first_df[col1], len(comb_df)))
combined_df[col2] = ss.zscore(signal.resample(np.diff(second_df[col2]), len(comb_df)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment