Creating chart / statistics for selected mysql table via python

I would like to start by asking for your opinion on how I should solve this problem, and not just how to structure my code.

Here is what I'm trying to do: I have a lot of data loaded into the mysql table for a lot of unique names + dates (i.e. when the date is a separate field). My goal is to choose a specific name (using rawinput and, possibly, add a drop-down menu in the future) and see a monthly trend with a moving average and, possibly, other statistics for one of the fields (income, monthly income, clicks, etc.) . What is your advice - move this data to excel book via python or is there a way to display this information in python (with charts that compare with excel, of course)?

Thank!

+3
source share
2 answers

The analysis of such data (name, date) can be considered as the issuance of special SQL queries to obtain information about timers.

You will "display" your information by date / time (day / week / month / year or more in detail by hours / minutes) depending on how large your data set is.

I often use such a query when the date field is truncated to the sampling rate, in mysql function DATE_FORMAT is cool for this (postgres and oracle use date_trunc and trunc respectfully)

What you want to see in your data is in your WHERE conditions.

select DATE_FORMAT(date_field,'%Y-%m-%d') as day,
       COUNT(*) as nb_event
FROM yourtable
WHERE name = 'specific_value_to_analyze'
GROUP BY DATE_FORMAT(date_field,'%Y-%m-%d');

csv. mysql, python script, , getopt ( , , , ..). .

โ€‹โ€‹, . (, sql), . Excel , ( ), .

Personaly dygraph, javascript-, , csv . - crossdomain, csv html-, Dygraph, ( , ).

webapp, django, -, URL- :

GET /timeserie/view/<category>/<value_to_plot>
GET /timeserie/csv/<category>/<value_to_plot> 

url , , url, csv Dygraph:

<script type="text/javascript">
  g3 = new Dygraph(
    document.getElementById("graphdiv3"),
    "{{ csv_url }}",
    {
      rollPeriod: 15,
      showRoller: true
    }
  );
</script>

URL- , sql /csv, Dygraph.

"" , , json javascript/framework.

open source, ( - ), , Pentaho, JasperReport, SOFA. , .

, - / javascript , BI, : -)

+2

: . , , , , .

, -. , ?

- , - web2py . .

dabo. , , . wxpython, , .

0

Source: https://habr.com/ru/post/1732708/


All Articles