项目作者: briwilcox

项目描述 :
Concurrent Pandas is a Python Library that allows you to use Pandas to concurrently download bulk data using threads or processes.
高级语言: Python
项目地址: git://github.com/briwilcox/Concurrent-Pandas.git
创建时间: 2014-09-19T23:05:36Z
项目社区:https://github.com/briwilcox/Concurrent-Pandas

开源协议:Apache License 2.0

下载


Concurrent-Pandas

Concurrent Pandas

Concurrent Pandas is a Python Library that allows you to use Pandas and / or Quandl to concurrently download bulk data using threads or processes. What does concurrency do for you? Download your data simultaneously instead of one key at a time, Concurrent Pandas automatically spawns an optimal number of processes or threads based on the number of processes available on your machine.

Note: Concurrent Pandas is not associated with Quandl or Python Pandas, it just allows you to access them faster.


Features

  • Sequential Downloading of Keys
  • Concurrent downloading of keys using thread or process pools
  • All Concurrent Downloading will automatically pick an optimal number of threads or processes to use for your system
  • Recursive data structure unpacking for key insertion
    • Pass one or many:
      • Lists
      • Sets
      • Deques
      • Any other data structures that inherit from abstract base class Container provided it is not also inheriting from Python basestring and it allows for iteration.
  • Automatic re-attempts if the download fails or times out
    • Retries increase the time to try again with each successive failure
  • Variety of data sources supported
    • Quandl
    • Federal Reserve Economic Data
    • Google Finance
    • Yahoo Finance
    • More coming soon!
  • Data is returned in a hashmap for fast lookups ( O(1) average case )
    • Hash Map Keys are the strings entered for lookup, buckets contain your Panda data frame

Easy to use

  1. # Define your keys
  2. yahoo_keys = ["aapl", "xom", "msft", "goog", "brk-b", "TSLA", "IRBT"]
  3. # Instantiate Concurrent Pandas
  4. fast_panda = concurrentpandas.ConcurrentPandas()
  5. # Set your data source
  6. fast_panda.set_source_yahoo_finance()
  7. # Insert your keys
  8. fast_panda.insert_keys(yahoo_keys)
  9. # Choose either asynchronous threads, processes, or a single sequential download
  10. fast_panda.consume_keys_asynchronous_threads()
  11. # The Concurrent Pandas object contains a dict of your results now
  12. mymap = fast_panda.return_map()
  13. # Easily pull the data out of the map for your research
  14. print(mymap["aapl"].head)

Installation Instructions

Note : only tested on Linux

To install execute:

  1. pip install ConcurrentPandas

Updates

New in 0.1.2
Ability to interact with stock options

Now requires BeautifulSoup4, and Pandas 0.16 or newer.


Misc

Tested on Python 2.7.6 and Python 3.4.0

To see what else I’m building or follow / contact me check out my github, twitter, and my personal site.