import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
# The following 2 lines tell matplotlib not to use the Xwindows backend
import matplotlib
matplotlib.use('Agg')


# DEFINE
def main():
    df = pd.read_csv('../../output/data_merged.csv')
    plot_data(df)
    df = clean_data(df)
    df.to_csv('../../output/data_cleaned.csv', index=False)


def plot_data(df):
    plt.hist(df['chips_sold'])
    plt.savefig('../../output/chips_sold.eps')


def clean_data(df):
    df['chips_sold'][df['chips_sold'] == -999999] = np.NaN
    return(df)


# EXECUTE
main()

import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
# The following 2 lines tell matplotlib not to use the Xwindows backend
import matplotlib
matplotlib.use('Agg')


# DEFINE
def main():
    df = pd.read_csv('../../output/data_merged.csv')
    plot_data(df)
    df = clean_data(df)
    df.to_csv('../../output/data_cleaned.csv', index=False)


def plot_data(df):
    plt.hist(df['chips_sold'])
    plt.savefig('../../output/chips_sold.eps')


def clean_data(df):
    df['chips_sold'][df['chips_sold'] == -999999] = np.NaN
    return(df)


# EXECUTE
main()

# The following 2 lines tell matplotlib not to use the Xwindows backend # DEFINE # EXECUTE