Code Monkey home page Code Monkey logo

Comments (4)

az-data-guru avatar az-data-guru commented on May 27, 2024 1

There seems to be an issue with the drill down itself. I ran the template and it through a KeyError.

from tableauscraper import TableauScraper as TS

url = 'https://tableau.azdhs.gov/views/ELR/TestsConducted?%3Aembed=y&'
ts = TS()
ts.loads(url)
wb = ts.getWorkbook()

sheetName = "P1 - Tests by Day W/ % Positivity (Both)"

drillDown1 = wb.getWorksheet(sheetName).levelDrill(drillDown=True, position=1)
drillDown2 = drillDown1.getWorksheet(sheetName).levelDrill(drillDown=True, position=1)
drillDown3 = drillDown2.getWorksheet(sheetName).levelDrill(drillDown=True, position=1)

print(drillDown1.getWorksheet(sheetName).data)
print(drillDown2.getWorksheet(sheetName).data)
print(drillDown3.getWorksheet(sheetName).data)

from tableau-scraping.

bertrandmartel avatar bertrandmartel commented on May 27, 2024

@az-data-guru You can get the correct data by dropping position=1 since it seems the position is now set to 0 (the default)

from tableau-scraping.

bertrandmartel avatar bertrandmartel commented on May 27, 2024

I've fixed the key error in any case

The following gets the data:

from tableauscraper import TableauScraper as TS

url = 'https://tableau.azdhs.gov/views/ELR/TestsConducted?%3Aembed=y&'
ts = TS()
ts.loads(url)
wb = ts.getWorkbook()

sheetName = "P1 - Tests by Day W/ % Positivity (Both)"

drillDown1 = wb.getWorksheet(sheetName).levelDrill(drillDown=True)
print(drillDown1.getWorksheet(sheetName).data["MONTH(Collection Date)-alias"])

drillDown2 = drillDown1.getWorksheet(sheetName).levelDrill(drillDown=True)
print(drillDown2.getWorksheet(
    sheetName).data["QUARTER(Collection Date)-alias"])

drillDown3 = drillDown2.getWorksheet(sheetName).levelDrill(drillDown=True)
print(drillDown3.getWorksheet(sheetName).data["YEAR(Collection Date)-alias"])

The problem is that the workbook doesn't retain the data so you can get the data between calls, you can get around this for now. I'm working on it

from tableau-scraping.

bertrandmartel avatar bertrandmartel commented on May 27, 2024

@az-data-guru I've fixed the getWorksheet and getWorksheets in the latest release.

Also since last week, the zones are stored in the scraper object, it means than you don't have to pass the last workbook to the next call anymore, since it's shared

For example:

from tableauscraper import TableauScraper as TS

url = 'https://tableau.azdhs.gov/views/ELR/TestsConducted?%3Aembed=y&'
ts = TS()
ts.loads(url)
sheetName = "P1 - Tests by Day W/ % Positivity (Both)"
ws = ts.getWorkbook().getWorksheet(sheetName)

drillDown1 = ws.levelDrill(drillDown=True)
drillDown2 = ws.levelDrill(drillDown=True)
drillDown3 = ws.levelDrill(drillDown=True)

print(drillDown1.getWorksheet(sheetName).data)
print(drillDown2.getWorksheet(sheetName).data)
print(drillDown3.getWorksheet(sheetName).data)

https://replit.com/@bertrandmartel/TableauCovidAZDHSTests

from tableau-scraping.

Related Issues (20)

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.