Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load from local CSV #12

Open
asfolcini opened this issue Jun 1, 2018 · 4 comments
Open

Load from local CSV #12

asfolcini opened this issue Jun 1, 2018 · 4 comments

Comments

@asfolcini
Copy link

Hi there,

Pls consider to load data from local CSV.

`

# Initialization requires a ticker symbol
def __init__(self, ticker, exchange='WIKI', csv_repository=""):

    # Enforce capitalization
    ticker = ticker.upper()

    # Symbol is used for labeling plots
    self.symbol = ticker

    # Use Personal Api Key
    #quandl.ApiConfig.api_key = 'xxxxxxxxxxxxxxxxxxxxxxxx'


    if exchange in "CSV":
        print("Load from CSV file...")
        stock = pd.read_csv(self.symbol_to_path(ticker,csv_repository), index_col='Date',
                            parse_dates=True,
                            # usecols=['Date', 'Open','High','Low','Adj Close','Volume'],
                            na_values=['nan'])
        #print(stock.head(5))
    else:
        # Retrieval the financial data from QUANDL
        try:
            stock = quandl.get('%s/%s' % (exchange, ticker))

        except Exception as e:
            print('Error Retrieving Data.')
            print(e)
            return

...
`

Check my modified version here: https://github.com/asfolcini/stocker/blob/master/stocker.py

@uriencedric
Copy link

Perhaps consider an adapter pattern here (ie QuandlSourceAdapter / CustomSourceApdapter ). It will provide extensible way of adding datasources for the library. What do you think ?

@skyking363
Copy link

skyking363 commented Jul 20, 2018

Sorry
I can't use it from local csv to run.
Can you give me an example?
THX

@kevb10
Copy link

kevb10 commented Jun 24, 2019

open a PR with the changes requested

@Rohan1280
Copy link

Sorry
I can't use it from local csv to run.
Can you give me an example?
THX

df=pd.read_csv(r'C:\Users\Rohan\Desktop\ML\linear_ref_multivariate\homeprices.csv')
@just add r before file location...After adding r, represents raw data.so u will not get any error after adding r.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants