Giter VIP home page Giter VIP logo

search_sampler's People

Contributors

gserapio avatar labsdeployuser avatar pewdozer[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

gserapio

search_sampler's Issues

error when searching by day

I've found another potential issue when testing example.py with all of the default parameters.

When pulling a single sample (Option 1) with 'period_length' set to 'day' in the example, the package returns a ValueError:

/search_sampler/venv/bin/python /search_sampler/example.py
INFO: Running period 2017-01-01 - 2017-02-01
Traceback (most recent call last):
  File "/search_sampler/example.py", line 40, in <module>
    run_pull()
  File "/search_sampler/example.py", line 31, in run_pull
    df_results = sample.pull_data_from_api(format="dataframe")
  File "/search_sampler/__init__.py", line 324, in pull_data_from_api
    return pandas.DataFrame(d_results)
  File "/search_sampler/venv/lib/python3.7/site-packages/pandas/core/frame.py", line 435, in __init__
    mgr = init_dict(data, index, columns, dtype=dtype)
  File "/search_sampler/venv/lib/python3.7/site-packages/pandas/core/internals/construction.py", line 254, in init_dict
    return arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
  File "/search_sampler/venv/lib/python3.7/site-packages/pandas/core/internals/construction.py", line 64, in arrays_to_mgr
    index = extract_index(arrays)
  File "/search_sampler/venv/lib/python3.7/site-packages/pandas/core/internals/construction.py", line 355, in extract_index
    raise ValueError("If using all scalar values, you must pass an index")
ValueError: If using all scalar values, you must pass an index

Process finished with exit code 1

I've also tried testing this on Python 2.7, but get the same error.

_get_file_path() cannot handle DMA codes as integers

First of all, this is a great package. A big thanks to the talented people at Pew Research for putting this out there.

It seems like the function _get_file_path() in search_sampler/_init_.py is rejecting DMA codes since the codes are stored as integers. At line 144:

str_path = os.path.join(self.output_path, self.params["region"])

Issue can be reproduced by running example.py with the 'region' parameter set to 500 (without quotes):

TypeError: join() argument must be str or bytes, not 'int'

Note that the issue can't be fixed by setting the 'region' parameter to '500' (as a string) because pull_data_from_api() requires params['region'] to be an integer.

error when searching by day

I've found another potential issue when testing example.py with all of the default parameters.

When pulling a single sample (Option 1) with 'period_length' set to 'day' in the example, the package returns a ValueError:

/search_sampler/venv/bin/python /search_sampler/example.py
INFO: Running period 2017-01-01 - 2017-02-01
Traceback (most recent call last):
  File "/search_sampler/example.py", line 40, in <module>
    run_pull()
  File "/search_sampler/example.py", line 31, in run_pull
    df_results = sample.pull_data_from_api(format="dataframe")
  File "/search_sampler/__init__.py", line 324, in pull_data_from_api
    return pandas.DataFrame(d_results)
  File "/search_sampler/venv/lib/python3.7/site-packages/pandas/core/frame.py", line 435, in __init__
    mgr = init_dict(data, index, columns, dtype=dtype)
  File "/search_sampler/venv/lib/python3.7/site-packages/pandas/core/internals/construction.py", line 254, in init_dict
    return arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
  File "/search_sampler/venv/lib/python3.7/site-packages/pandas/core/internals/construction.py", line 64, in arrays_to_mgr
    index = extract_index(arrays)
  File "/search_sampler/venv/lib/python3.7/site-packages/pandas/core/internals/construction.py", line 355, in extract_index
    raise ValueError("If using all scalar values, you must pass an index")
ValueError: If using all scalar values, you must pass an index

Process finished with exit code 1

I've also tried testing this on Python 2.7, but get the same error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.