Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
KingNastidon
Jun 25, 2004
Just getting started with pandas, so this is probably a really naive question. I'm trying to replicate a really basic algorithm from VBA for oncology forecasting. There is a data file with new patient starts and anticipated duration of therapy in monthly cohorts. Each new patient cohort loses a certain amount of patients each time period using an exponential function to mimic the shape of a kaplan-meier progression curve. The sum of a column represent the total remaining patients on therapy across all cohorts. Below is the code I'm using:

code:
for x in range(0, nummonths):
    for y in range(x, nummonths):
        cohorts.iloc[x,y] = data.ix[x,'nps'] * math.pow(data.ix[x,'duration'], y-x)
Calculating this n by n array with n>500 is instantaneous in VBA, but is taking 10+ seconds in pandas with jupyter. Any thoughts on what makes this so slow in pandas or better way to go about this?

KingNastidon fucked around with this message at 06:15 on Mar 31, 2017

Adbot
ADBOT LOVES YOU

KingNastidon
Jun 25, 2004
Are there any good packages for spitting out simple pandas dataframes in html format? I've been using altair a lot recently to create quick interactive visualizations + export to html, but don't think there's functionality to display the underlying data in a browser friendly format. Basic functionality like searching or sorting would be great. Don't need to host it on the web and the source data is static. My customers are reticent to open xls files much less fiddle with filters.

KingNastidon
Jun 25, 2004

The Xkdc Larper posted:

drat altair looks sweet. The dataframe method .to_html() will produce a simple html table with no markup. From there you can use the DataTables jquery plugin to add sorting and filters. You'll probably need to make header and footer files of html/JS/CSS to accomplish all the formatting stuff though.

Thank you, DataTables looks awesome and I can definitely use this. I want to be half as smart and ambitious as the github folks that link together this poo poo. For this project I'm trying to find something that's pretty bolt-on given I mostly do excel and rudimentary data work in python, but know nothing about html/JS/CSS other than kind of understanding what's going on.

What I'm trying to do is basically create a lazy (or poor man that can't get funding) Tableau or Veeva for CRM. Create points on a map, allow end users to click on that point, and spit out data associated with that point. For example, customers/sales data/internal employees responsible. Like, imagine this combined with this where selecting a map point on the left would spit out summarized data tables on the right.

This probably is begging for a web app that can real-time query the selection from underlying database, but live in a flat-file csv/xls/ppt world.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply