jamalsenouci / causalimpact

Python port of CausalImpact R library
Apache License 2.0
262 stars 62 forks source link

CSV Data? #14

Closed Jamiedee90 closed 5 years ago

Jamiedee90 commented 5 years ago

Hi,

If I wanted it to read from a CSV file:

data = pd.read_csv('Traffic.csv',header=None,names = ['CountryX','CountryY'])

where would I need to save the file for it read this?

Many Thanks JD

rpanai commented 5 years ago

@Jamiedee90 it seems to me you already read that file. Do you mind to tel us how is this related to causalimpact?

Jamiedee90 commented 5 years ago

Hi @rpanai

apologies, this was just a dummy line of code. this is to replace the lines:

_np.random.seed(1)

x1 = arma_generate_sample(ar=[0.999], ma=[0.9], nsample=100) + 100 y = 1.2 * x1 + np.random.randn(100)

y[71:100] = y[71:100] + 10 data = pd.DataFrame(np.array([y, x1]).T, columns=["y","x1"])_

This makes it easier to update the data and re use the test across different clients

jamalsenouci commented 5 years ago

You can save it wherever you want as long as you reference the path in pd.read_csv. In your example traffic.csv would be located in the same directory you are running the code from.