{ "info": { "author": "Sanjay Yadav", "author_email": "sanjay.yadav@gramener.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Topic :: Office/Business :: Office Suites", "Topic :: Software Development :: Libraries" ], "description": "# PPTGen\n\nPPTGen lets you modify the contents of a PowerPoint presentation based on data.\nFor example, you can:\n\n- Update charts, images and text from data\n- Create a series of slides using a template from spreadsheets or database\n\nIt is a command line utility and a Python function packaged with Gramex.\nIt forms the basis of PPTXHandler.\n\n## Command line usage\n\nPPTGen uses a configuration to modify files. The configuration defines the\n`source`, `target`, `data` and any number of rules.\n\nOn the command line, it accepts a YAML file as input. For example, this\n`text.yaml` copies input.pptx to output.pptx and changes the title to \"New Title\":\n\n```yaml\nsource: input.pptx # optional path to source. Default to blank PPT with 1 slide\ntarget: output.pptx # required path to save output as\nchange:\n Title 1: # Take the shape named \"Title 1\"\n text: New Title # Replace its text with \"New Title\"\n```\n\nThis can be run as:\n\n pptgen text.yaml\n\nYou can override parameters from the command line like this:\n\n pptgen config.yaml --target new.pptx \"--change.Title 1.text\" \"Updated title\"\n\n## API usage\n\nAs an API, it accepts keyword arguments as the configuration. For example:\n\n```python\nfrom pptgen import pptgen\npptgen(\n source='input.pptx', # optional path to source. Defaults to blank PPT with 1 slide\n target='output.pptx', # optional target. Otherwise, returns the pptx.Presentation()\n change={ # Configurations are same as when loading from the YAML file\n 'Title 1': { # Take the shape named \"Title 1\"\n 'text' 'New Title' # Replace its text with \"New Title\"\n }\n }\n)\n```\n\nHere is another example that changes a bar chart based on data:\n\n```python\nimport pandas as pd\nfrom pptgen import pptgen\ndata = {'chart_data': pd.read_csv('data.csv')}\npptgen(\n source='input.pptx',\n target='output.pptx',\n edit_chart={\n 'Bar Chart Shape Name': {\n 'chart': {\n 'data': data['chart_data'],\n 'x': 'Category',\n 'size': 'PreY',\n 'color': {\n 'function': \"{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}\"\n }\n }\n }\n }\n)\n```\n\n# Configuration\n\nThe configuration accepts the following top-level keys:\n\n- `source`: optional. Path to input Presentation to be used as the source.\n Defaults to a blank presentation with 1 slide.\n- `target`: required for the command line, and is where the output PPTX is saved.\n It is optional for the API. If None, `pptgen` returns the Presentation object.\n- `data`: optional dataset or a dictionary. This is described below.\n- `register`: Optional to register any new custom commands to pptgen. It accepts a function which accepts three parameter `shape`, `spec`, and `data`. Available `immutable` commands in pptgen are `css`, `text`, `image`, `chart`, `table`, `sankey`, `bullet`, `replace`, `treemap`, `heatgrid` and `calendarmap`.\n- All other keys are treated as rules that are described below.\n\n## Data\n\nPPTGen can change presentations with data from various sources. It uses\n`gramex.data.filter`. It supports these keys:\n\n- `url:` Pandas DataFrame, sqlalchemy URL or file name\n- `ext:` file extension (if url is a file). Defaults to url extension\n- `args`: optional filters to apply to dataset. Passed as a dict of lists\n- `table:`: table name (if url is an SQLAlchemy URL)\n- `query:` optional SQL query to execute (if url is a database)\n- `transform:`: optional in-memory transform. Takes a DataFrame and returns a DataFrame\n- Any additional keys are passed to `gramex.cache.open` or `sqlalchemy.create_engine`\n\n```yaml\ndata:\n cities: {url: cities.csv} # Load cities.csv into \"cities\" key\n sales: {url: sales.xlsx, sheet: Sheet1} # Load Sheet1 from sales.xslx into \"sales\" key\n tweets: {url: tweets.json} # Load JSON data into \"tweets\" key\n sample: {url: mysql://server/db, table: sample} # Load sample data from MySQL\n filter:\n url: cities.csv # Load cities.csv\n args: # Filter results\n Country: [Egypt, Sudan] # WHERE column Country is Egypt or Sudan\n Population>: 100000 # AND column Population is 100,000+\n```\n\n## Rules\n\nThe configuration can define any number of rules. Rules have:\n\n- one or more [shape names](#shapes), and the list of [commands](#commands) to\n apply to those shapes.\n- an optional [slide selector](#slides) that restricts which slide they apply to.\n By default, rules apply to all slides.\n\nIn the example below, there is 1 rule called `change`. It does no slide selector,\nso it applies to all slides. It has 1 shape: `Title 1` with 1 command: `text`:\n\n```yaml\nsource: input.pptx # optional path to source. Default to blank PPT with 1 slide\ntarget: output.pptx # required path to save output as\nchange:\n Title 1: # Take the shape named \"Title 1\"\n text: New Title # Replace its text with \"New Title\"\n```\n\n### Slides\n\nBy default, changes are applied to all slides. To restrict changes to a specific\nslide, use:\n\n1. `slide-number` slide number or list (with the first slide as slide 1).\n1. `slide-title` is a regular expression that matches the slide title.\n\n```yaml\nsource: input.pptx\ntarget: output.pptx\nrule-1: # rule-1 applies to all slides\n ...\nrule-2:\n slide-number: 1 # rule-2 applies only to the first slide of the source\n ...\nrule-3:\n slide-title: Hello # rule-3 applies to slides with the title \"Hello\" (regex)\n ...\n ...\n```\n\nTo create multiple slides from data, add `data:` to the change. For example:\n\n```yaml\nsource: input.pptx\ntarget: output.pptx\ndata:\n sales: {url: sales.xlsx}\nchange-title:\n data: data['sales'].ix[0].to_dict(orient='records') # For each row in the sales dataset (defined above)\n slide-number: 1 # ... copy slide 1 and apply this change\n Title 1:\n text: \"Region {{ region }} has sales of ${{ sales }}\"\n```\n\nThis `data:` is an [expression](#expressions) using the root `data:` variables.\nIt can be used with\n\n- `slide-number` to repeat 1 or more slides. For example `slide-number: [1,2]`\n will copy slides 1 & 2 as many times as there are rows of data\n- `slide-title` to repeat individual slides or multiple single slides\n\nSlide numbers always refers to the source slide number, not the target slide\nnumber. Even if a slide is duplicated in the target, source slide numbers do not\nchange.\n\n### Shapes\n\nIn PowerPoint, all shapes have names. To see shape names, select Home tab >\nDrawing group > Arrange drop-down > Selection pane. Or press ALT + F10.\n\n![Selection pane](help/selection-pane.png)\n\nTo change the shape names, double-click on the name in the selection pane.\n\nYou can specify changes to one or more shapes in a [rule](#rules). For example:\n\n```yaml\nrule-1:\n Title 1:\n text: New title\n background-color: red\n Text 1:\n text: New text\n color: green\n```\n\n... changes 2 shapes named `Title 1` and `Text 1`.\n\nShape names may refer to native elements or [groups](#groups).\n\n### Groups\n\nShape names may refer to groups. To change groups' contents, use a nested\nconfiguration. For example, if \"Group 1\" has \"Caption\" and \"Picture\" inside it,\nthis `config-group.yaml` replaces those:\n\n```yaml\nsource: input.pptx\ntarget: output.pptx\nchange-image:\n Group 1: # Take the shape named \"Group 1\"\n Caption: # Find the shape named \"Caption\" inside it\n text: New caption # Change its text to \"New caption\"\n Picture: # Find the shape named \"Picture\" inside it\n image: sample.png # Replace the image with sample.png\n```\n\n### Register: Register a new command to PPTGen\n\nRegister let you create a custom command. It accepts a function which will accepts three parameters, `shape`, `spec`(configuration for a shape, config under the shape name), `data` in same order. It will not accept any other parameter except these 3. Any existing command can not be overwrite. Return an immutable command list.\n\n```yaml\nsource: input.pptx\ntarget: output.pptx\ndata:\n load_data: {url: data.csv}\nregister:\n custom_command1: view.custom_command1 # Registering a new command as `custom_command1.`\n custom_command2: view.custom_command2 # Registering a new command as `custom_command2.`\n custom_command3:\n function: view.custom_command3 # Registering a new command as `custom_command3.`\n\ncustom-config: # Rule\n Shape Name 1: # Shape Name\n custom_command:\n .... Configuration\n Shape Name 2:\n custom_command2:\n .... Configuration\n Shape Name 3:\n custom_command3:\n .... Configuration\n\n```\n\n## Commands\n\nShapes can be changed using 1 or more commands. These commands can change the\nshape's style and content, or add new content (like charts).\n\n### CSS\n\nThe following CSS-like commands change the shape's display attributes:\n\n- `data`: Loads data\n- `style`: Accepts css like properties\n\n - `opacity`: sets the shape's opacity level as a decimal from 0 - 1\n - `color`: sets the text / foreground color as CSS colors\n - `fill`: sets the shape's background color as CSS colors\n - `stroke`: sets the shape outline color as CSS colors\n - `width`: sets the shape width in points\n - `height`: sets the shape height in points\n - `left`: sets the shape X position in points\n - `top`: sets the shape Y position in points\n - `font-size`: sets the font size in points\n - `font-family`: sets the font family as a font name\n\nExample:\n```yaml\n Rectangle 1: # Take the shape named \"Rectangle 1\"\n css:\n data: data['sales']\n style:\n opacity: 0.5\n color: '#ff0000'\n fill: '#ffff00'\n stroke: '#ffff00'\n width: 100\n height: 150\n left: 30\n top: 50\n font-size: 14\n font-family: Georgia\n```\nCSS colors can be specified in the same way they can in CSS.\n1 point is 1/72 inches. All `style` elements and `data` will accept python expression or python function.\n\nValues support [expressions](#expressions).\n\n### Text\n\nTo change the title on the input slide to \"New title\", use this configuration:\n\n```yaml\n Title 1: # Take the shape named \"Title 1\"\n text: New Title # Replace its text with \"New Title\"\n```\n\n`text:` values support [templates](#templates).\n\n### Replace\n\nTo *substitute* text instead of [replacing the full text](#text), use:\n\n```yaml\n Title 1: # Take the shape named \"Title 1\"\n replace: # Replace these keywords\n \"Old\": \"New\" # Old -> New\n \"Title\": \"Heading\" # Title -> Heading\n```\n\nReplacement only works for words that have the same formatting. For example, in\nsome_where_, \"where\" is underlined. You cannot replace \"somewhere\". But you can\nreplace \"some\" and \"where\" independently.\n\n`replace:` values support [templates](#templates).\n\n### Image\n\nTo change the picture on an image, use:\n\n```yaml\n Picture 1: # Take the shape named \"Picture 1\"\n image: sample.png # Replace the image with sample.png\n```\n\n`image:` values support [template](#templates), and can be a URL or file path.\n\n### Table\n\nModifies existing tables. It accepts these keys:\n\n- `data:` optional data [expression](#expressions) to render as the table. The\n table expands on shrinks to accommodate the rows and columns in the data.\n- `style:` optional common css for all columns. E.g.- color, fill, font-size etc. These properties can be ovewrite inside a column. If not then property will be common for all columns.\n - `bold`: True or False, if True text will be show in bold.\n - `fill`: Color of the cells.\n - `color`: Text color.\n - `italic`: To set text's itallic style.\n - `underline`: To set text's underline style.\n - `font-size`: Font size of text.\n - `font-family`: Text's font family.\n - `gradient:` optional gradient name (binary, Blues, BuGn, BuPu, gist_yarg, GnBu, Greens, Greys, Oranges, OrRd, PuBu, PuBuGn, PuRd, Purples, RdPu, Reds, YlGn, YlGnBu, YlOrBr, YlOrRd, BrBG, bwr, coolwarm, PiYG, PRGn, PuOr, RdBu, RdGy, RdYlBu, RdYlGn, seismic).\n - `min:` optional minimum. Defaults to the column's min value\n - `max:` optional maximum. Defaults to the column's max value\n- `columns:` A dictionary config for the columns. Inside this style properties can be defined and can overwrite common styles from `style` section. Only defined columns inside `columns` section will get populated inside table.\n\n```yaml\ncolumns:\n Category: {} # Not overwriting common css styles but Category column will be shown in table\n Sales: # Defining style for Sales column\n gradient: Greens\n font-size: 14\n Profit: # Defining style for Profit column\n font-family: Georgia\n```\n\n```yaml\nsource: table-input.pptx\ntarget: table-output.pptx\ndata:\n table_data: {ext: csv, url: table-data.csv}\n\nnew-edit-table:\n Table:\n table:\n data: data['table_data']\n style: # Common CSS for all the cells\n font-size: 18\n text-align: center\n italic: True\n underline: True\n columns:\n Sales: # Common CSS will get over-write for Sales column\n gradient: Reds\n GrossProfit: # Common CSS will get over-write for GrossProfit column\n font-size: 30\n bold: False\n underline: False\n italic: False\n color: '#ff00ff'\n```\n\n### Replicate\n\nTo create multiple shapes using data, use `replicate:` and `data:`. For example:\n\n```yaml\ndata:\n sales: {xlsx: sales.xlsx}\nmultiple-objects: # Rule\n # Slide 1, 2 will get replicated for all Categories (that is unique groups from groupby below), if slide-number is defined else all slides will get replicated.\n slide-number: [1, 2] # This rule will get apply only on these slides.\n data: data['sales'].groupby('Category')\n replicate: True # Entire rule will replicate for defined slides, if slide-number is defined else all slides will get replicated.\n Picture 1: # Take the Picture 1 shape\n margin: 10 # With a padding of 10 units\n image: \"{{ region }}.png\" # Change the picture using this template\n```\n\n### Stack\n\nReplicate a shape multiple times based on data vertically or horizontally. For example:\n\n```yaml\ndata:\n sales: {xlsx: sales.xlsx}\nmultiple-objects: # Rule\n Text 1: # Take the Picture 1 shape\n data: data['sales'].to_dict(orient='records')\n stack: horizontal # Lay the images out horizontally to the right\n margin: 10 # With a padding of 10 units\n text: \"{{ Category }}\" # Change the text using this template\n```\n\n\nThis `data:` is an [expression](#expressions) using the root `data:` variables.\nFor each row in `data`, the shape is duplicated and laid out based on `replicate:`.\n\n`stack:` supports these layouts:\n\n- `horizontal` copies the element right with an optional `margin` (default: 0)\n- `vertical` copies the element below with an optional `margin` (default: 0)\n\n### Templates\n\nFor commands that support templates, values inside `{{ ... }}` are evaluated as\nPython expressions in the context of `data`.\n\nFor example:\n\n```yaml\ndata:\n tweets: tweets.json\nchange:\n Title 1:\n text: `Tweet from @{{ tweets[0]['user']['screen_name'] }}`\n```\n\n... will replace the contents inside `{{ ... }}` with the value of\n`tweets[0]['user']['screen_name']` evaluated in Python. The variable `tweets` is\nthe result of loading `tweets.json`.\n\n### Expressions\n\nFor commands that support expressions, values are evaluated as Python expressions\nin the context of data. For example:\n\n```yaml\ndata:\n tweets: tweets.json\nchange:\n slide: 1\n data: sales.groupby('city') # replicates slide 1 for every item in sales.groupby('city')\n```\n\n### Deprecated commands\n\n- `rectangle`: use [CSS](#css) commands instead\n- `oval`: use [CSS](#css) commands instead\n\n\n## Native charts\n\nTo modify the data and attributes for an existing native chart, use `chart:`.\nThis supports the following chart types:\n\n- Bar charts: Clustered Bar, Stacked Bar, 100% Stacked Bar\n- Column charts: Clustered Column, Stacked Column, 100% Stacked Column\n- Line charts: Line, Stacked Line, 100% Stacked Line, Line with Markers, Stacked Line with Markers, 100% Stacked Line with Markers\n- Area charts: Area, Stacked Area, 100% Stacked Area (3D area not supported)\n- Scatter charts: Scatter, Scatter with Straight Lines, Scatter with Smooth Lines, Scatter with Straight Lines and Markers, Scatter with Smooth Lines and Markers\n- Bubble charts: Bubble, 3-D Bubble\n- Radar charts: Radar, Radar with Markers, Filled Radar\n- Donut charts: Doughnut, Doughnut Exploded\n- Pie charts: Pie, Pie Exploded, Bar of Pie (3D pie not supported)\n\nHere are examples that assume the following configuration:\n\n```yaml\nsource: input.pptx # This must already have the relevant chart\ntarget: output.pptx\ndata: # This dictionary is available to all charts as \"data\"\n sales: {url: sales.csv} # The examples assume a dataset called \"sales\"\n```\n\nHere are examples for various charts:\n\n```yaml\nedit-charts: # Rule name\n Bar Chart Name:\n chart:\n data: data['sales'][['Category', 'Sales', 'Profit', 'Growth']]\n x: Category\n color: # Define colors\n Sales: #D73027 # Specify color of sales line in 6-digit hex\n Profit: #1A9850 # Specify color of profit line\n Growth: #cccccc # Specify color of profit line\n\n Column Chart Name:\n chart:\n data: data['sales'][['Category', 'Sales', 'Profit', 'Growth']]\n x: Category\n color: # Define colors\n Sales: #D73027 # Specify color of sales line in 6-digit hex\n Profit: #1A9850 # Specify color of profit line\n Growth: #cccccc # Specify color of profit line\n\n Line Chart Name:\n chart:\n data: data['sales'][['Category', 'Sales', 'Profit', 'Growth']]\n x: Category\n color: # Define colors\n Sales: #D73027 # Specify color of sales line in 6-digit hex\n Profit: #1A9850 # Specify color of profit line\n Growth: #cccccc # Specify color of profit line\n\n Area Chart Name: # Name of the chart shape. Case sensitive\n chart:\n data: data['sales'][['Category', 'Sales', 'Profit', 'Growth']] # Use sales data\n x: Category # The x-axis is the Category column. Other columns are Y-axis values\n color: # Define colors\n Sales: #D73027 # Specify color of sales line in 6-digit hex\n Profit: #1A9850 # Specify color of profit line\n Growth: #cccccc # Specify color of profit line\n opacity: 0.50 # Constant opacity for all lines\n\n Scatter Chart Name:\n chart:\n data: data['sales'][['Category', 'Sales', 'Profit', 'Growth']]\n x: Category\n color: # Define colors\n Sales: #D73027 # Specify color of sales line in 6-digit hex\n Profit: #1A9850 # Specify color of profit line\n Growth: #cccccc # Specify color of profit line\n\n Bubble Chart Name:\n chart:\n data: data['sales'][['Category', 'Sales', 'Profit', 'Growth']]\n x: Category\n size: Growth # Optional: Column name from data for the size of the bubbles, if not defined default size will be 1\n color: # Define colors\n Sales: #D73027 # Specify color of sales line in 6-digit hex\n Profit: #1A9850 # Specify color of profit line\n Growth: #cccccc # Specify color of profit line\n\n Radar Chart Name:\n chart:\n data: data['sales'][['Category', 'Sales', 'Profit', 'Growth']]\n x: Category\n color: # Define colors\n Sales: #D73027 # Specify color of sales line in 6-digit hex\n Profit: #1A9850 # Specify color of profit line\n Growth: #cccccc # Specify color of profit line\n\n Donut Chart Name:\n chart:\n data: data['sales'][['Category', 'Sales', 'Profit', 'Growth']]\n x: Category\n color: # Define colors\n Sales: #D73027 # Specify color of sales line in 6-digit hex\n Profit: #1A9850 # Specify color of profit line\n Growth: #cccccc # Specify color of profit line\n\n Pie Chart Name:\n chart:\n data: data['sales'][['Category', 'Sales', 'Profit', 'Growth']]\n x: Category\n color: # Define colors\n Sales: #D73027 # Specify color of sales line in 6-digit hex\n Profit: #1A9850 # Specify color of profit line\n Growth: #cccccc # Specify color of profit line\n```\n\nThe following keys can also be specified as an [expression](#expressions) and python functions:\n`data:`, `x:`, `color:`, `opacity:`, `size:`.\n\nFor example, this example sets the opacity of columns named \"dummy\" as 0.2, and\nother columns as 1.0.\n\n```yaml\n opacity:\n function: '{col: 0.2 if \"dummy\" in col else 1.0 for col in data.columns}'\n```\n\n## Custom charts\n\npptgen lets you create these custom charts:\n\n- Bullet chart\n- Calendarmap\n- Heatgrid\n- Sankey\n- Treemap\n\nTo create these, add a rectangle shape (no other shape is allowed) in your slide.\nWhen a custom chart is applied on that rectangle, it replaces the rectangle with\nthe chart.\n\n### Bullet\n\n- `data`: Actual value.\n- `poor`: Poor value.\n- `good`: Good value.\n- `target`: Target value.\n- `gradient`: Optional. Default `RdYlGn`.\n- `text`: Default `True`. Optional, if present text will be shown as per format. Text can be overwrite inside `style.data.text` or `style.target.text` section if defined there.\n- `style`: Optional `dict`, accepts css properties `e.g:- font-color, fill, opacity etc.`\n\nExample:\n\n```yaml\ndraw-bullet:\n Bullet Rectangle:\n bullet:\n data: data['bullet_data']['data'].ix[0]\n poor: data['bullet_data']['poor'].ix[0]\n good: data['bullet_data']['good'].ix[0]\n target: data['bullet_data']['target'].ix[0]\n average: data['bullet_data']['average'].ix[0]\n orient: horizontal\n gradient: 'Oranges'\n text:\n function: \"lambda v: '%.1f' % v\"\n style:\n font-size: 10 # Common css for all items(data, target, poor, good and average)\n color: '#ff0000'\n data: # Overwriting CSS for data\n font-size: 12\n fill: #ff00ff\n target: # Overwriting CSS for target\n text: False # Overwriting text for text. Text will not be shown\n font-size: 12\n color: '#cccccc'\n```\n\nThe following keys can also be specified as an [expression](#expressions) and python functions:\n`data:`, `target:`, `poor:`, `good:`, `average:`, `gradient`, `text` along will all style properties such as under style section `font-size`, `opacity`, `fill`, `color` etc.\n\n### Calendarmap\n\n- `width`: Width and height of each cell(in pixel) in calendarmap.\n- `weekstart`: Weekstart value `date`.\n- `gradient`: Optional, default `RdYlGn`.\n- `format`: Number format to be shown in top/left bar if `label_top/lebel_left` defined.\n- `lo`: Min value for color scale `default min from data`.\n- `hi`: High value for color scale `default max from data`.\n- `label_top`: Top margin for the calendermap `default 0`.\n- `label_left`: Left margin for the calendermap `default 0`.\n- `style`: A `dict`, accepts `CSS` properties e.g-`color, fill, opacity, font-size, etc.`\n\nExample:\n\n```yaml\ndraw-calendar:\n Calendar Rectangle:\n calendarmap:\n data:\n function: data['calendar_data'].sort_values(by=['date_time']).set_index('date_time')['random_column']\n width: 40\n weekstart: 6\n label_top: 80\n label_left: 80\n startdate: data.index[0]\n style:\n color: '#000000'\n```\n\nThe following keys can also be specified as an [expression](#expressions) and python functions:\n`data:`, `startdate:`, `lo:`, `hi:`, `weekstart:` and subelements of `style` section.\n\n### Heatgrid\n\n- `data`: A DataFrame.\n- `row`: Columns name from data which will be get treated as `row` in heatgrid.\n- `column`: Columns name from data which will be get treated as `column` in heatgrid.\n- `value`: Columns name from data to show for each cell heatgrid.\n- `text`: Default `False` if defined text inside cell will be formated.\n- `left-margin`: In percentage(0-1) of total width of shape. Left margin from the shape from where heatgrid will start populating.\n- `cell-width`: Width of each cell. Default based on columns width of shape will defined.\n- `cell-height`: Height of each cell. Default based on number of rows height of shape will defined.\n- `na-text`: Treat `NA` values text representation.\n- `na-color`: Cell color for `NA` values.\n- `style`: optional `dict`, to apply css properties.\n\nExample:\n\n```yaml\ndraw-heatgrid:\n Heatgrid Rectangle:\n heatgrid:\n data: data['heatgrid_data']\n row: name\n column: hour\n value: value\n text: True\n left-margin: 0.20\n cell-width: 30\n cell-height: 30\n na-text: NA\n na-color: '#cccccc'\n style:\n gradient: RdYlGn\n color: '#ff0000'\n font-size: 14\n margin: 10\n text-align: center\n```\n\nThe following keys can also be specified as an [expression](#expressions) and python functions:\n`data:`, `row:`, `column:`, `value:` and subelements of `style` section.\n\n\n### Sankey\n\n- `data`: A DataFrame.\n- `sort`: `True` or `False` if true data will get sorted while drawing sankey.\n- `text`: Function to show text in sankey.\n- `order`: Groups order.\n- `color`: Color function based on which\n- `groups`: Group column names from data.\n\nExample:\n\n```yaml\ndraw-sankey:\n Sankey Rectangle:\n sankey:\n data: data['sankey_data']\n sort: True\n text:\n function: \"lambda g: g.sum().apply(lambda v: 'Node %s' % (v.name,), axis=1)\"\n order:\n function: \"lambda g: -g['D'].sum() / g['E'].sum()\"\n color:\n function: \"lambda g: _color.gradient(g['D'].sum() / g['E'].sum() * 2 - 1, _color.RdYlGn)\"\n groups: ['A', 'B', 'C']\n stroke: '#ffffff'\n```\n\nThe following keys can also be specified as an [expression](#expressions) and python functions:\n`data:`, `size:`, `order:`, `text:`, `color`.\n\n### Treemap\n\n- `data`: A DataFrame.\n- `keys`: Group column names as `list`.\n- `values`: Aggregate function to apply on each group.\n- `size`: Treemap's box size function.\n- `sort`: Function to sort treemap's rectangles based on `sort` function.\n- `color`: A DataFrame.\n- `text`: Function to show text in treemap.\n\nExample:\n\n```yaml\ndraw-treemap:\n Treemap Rectangle:\n treemap:\n data: data['treemap_data']\n keys: ['A', 'B']\n values: \"{'C': 'sum', 'D': 'sum'}\"\n size:\n function: \"lambda v: v['C']\"\n sort:\n function: \"lambda v: v.sort_values(by=['C'], ascending=False)\"\n color:\n function: \"lambda v: _color.gradient(v['C'] / v['D'] - 1, _color.RdYlGn)\"\n text:\n function: \"lambda v: 'Num %d' % v['index']\"\n```\n\nThe following keys can also be specified as an [expression](#expressions) and python functions:\n`data:`, `size:`, `keys:`, `values:`, `sort`, `color`, `text`.\n\n# Development\n\nTo set up the development environment, clone this repo. Then run:\n\n pip uninstall pptgen\n pip install -e .\n\nCreate a branch for local development using `git checkout -b `.\nTest your changes by running `make clean tests`.\nCommit your branch and send a merge request.\n\n## Release\n\nWhen releasing a new version of pptgen:\n\n1. Check [build errors](http://code.gramener.com/sanjay.yadav/pptgen/pipelines).\n2. Run `make clean tests` on Python 2.7 and on 3.x\n3. Update version number in `pptgen/release.json`\n4. Push `dev` branch to the server. Ensure that there are no build errors.\n5. Merge with master, create an annotated tag and push the code:\n\n git checkout master\n git merge dev\n git tag -a v1.x.x # Annotate with a one-line summary of features\n git push --follow-tags\n git checkout dev # Switch back to dev\n\n6. Release to PyPi\n\n python setup.py sdist bdist_wheel --universal\n twine upload dist/*\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://code.gramener.com/sanjay.yadav/pptgen", "keywords": "powerpoint,ppt,pptx,office,open xml", "license": "Gramener", "maintainer": "", "maintainer_email": "", "name": "pptgen", "package_url": "https://pypi.org/project/pptgen/", "platform": "", "project_url": "https://pypi.org/project/pptgen/", "project_urls": { "Homepage": "http://code.gramener.com/sanjay.yadav/pptgen" }, "release_url": "https://pypi.org/project/pptgen/0.2.1/", "requires_dist": [ "orderedattrdict (>=1.4.3)", "pandas (>=0.19)", "python-pptx (>=0.6.6)", "pyyaml (>=3.10)", "setuptools (>=16.0)", "six", "tornado (>=4.3)" ], "requires_python": "", "summary": "Make PowerPoint presentations from data", "version": "0.2.1" }, "last_serial": 3296801, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "cd636758173103d2fee0ef3981da7710", "sha256": "46cfa265b977c155a369c50972d5079548a046f09e2cf413bab071c6aa940d86" }, "downloads": -1, "filename": "pptgen-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "cd636758173103d2fee0ef3981da7710", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 52109, "upload_time": "2017-09-01T05:05:45", "url": "https://files.pythonhosted.org/packages/ad/a9/58c2d36ebc095c1e629272a685a334e7c18054f0f684a142d568f57ac834/pptgen-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0fac52062ef3d7e2215f719e5530afc6", "sha256": "adddf8774d7b203905cb4e431bd6b9829a50ad501f3930199f5dc5ba800f44ea" }, "downloads": -1, "filename": "pptgen-0.1.0.tar.gz", "has_sig": false, "md5_digest": "0fac52062ef3d7e2215f719e5530afc6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 49115, "upload_time": "2017-09-01T05:05:46", "url": "https://files.pythonhosted.org/packages/db/2f/e80342a973c3ee65c882ec7f2d2484ae717ccb444f5166574f376f896f98/pptgen-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "42ad6460340671bb367cc73715ac79ce", "sha256": "3aabc633d99a157e178a208150bfcc7e3c6175d2f8e4a76cd55bb3395d305aee" }, "downloads": -1, "filename": "pptgen-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "42ad6460340671bb367cc73715ac79ce", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 39262, "upload_time": "2017-09-25T14:06:20", "url": "https://files.pythonhosted.org/packages/67/5a/5512fc6f3e5565e1f24d91c61eb112a416c05403f1e8f4ab57ef204cf523/pptgen-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "91d4f8c4875453cea88390b7e4524778", "sha256": "0195244f877af45ecafb0cf8043d7fc5a6aa003b45386837230f856fa7c7b253" }, "downloads": -1, "filename": "pptgen-0.1.1.tar.gz", "has_sig": false, "md5_digest": "91d4f8c4875453cea88390b7e4524778", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36882, "upload_time": "2017-09-25T14:06:23", "url": "https://files.pythonhosted.org/packages/21/18/65b21f90b2c4386df2397f89a1f65ba1e2eace6bf16743c9ec928d8d9ab6/pptgen-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "08f3400a9fc019c315789ce57dcbf197", "sha256": "8ab2382e84add2710f5e90e486e42d5c3163200212dc0a97dc45d0b62e465703" }, "downloads": -1, "filename": "pptgen-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "08f3400a9fc019c315789ce57dcbf197", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 53228, "upload_time": "2017-10-31T15:06:52", "url": "https://files.pythonhosted.org/packages/1a/23/ea90c9f2b618e920ddde7ec7b97f3f44b6c7e526c72ebd9908c31794d2ec/pptgen-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "31dcd352703675fd4d3a7f4eeae2e5a1", "sha256": "bd16e644fa789e9c9d6b1e221f66e769c8abd5288e742b1da99e598f970a8102" }, "downloads": -1, "filename": "pptgen-0.2.0.tar.gz", "has_sig": false, "md5_digest": "31dcd352703675fd4d3a7f4eeae2e5a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 51130, "upload_time": "2017-10-31T15:06:55", "url": "https://files.pythonhosted.org/packages/fd/4a/21f839e67ef3c126964344843a068454a3fbf931456284bfada34545a1dd/pptgen-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "5a982ce6a6c86e6396661f2ffbd56020", "sha256": "9d523ff9fec41224311ba1710c1617019664114e900c314f832d8b7e35d29fbe" }, "downloads": -1, "filename": "pptgen-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5a982ce6a6c86e6396661f2ffbd56020", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 51971, "upload_time": "2017-11-01T11:19:55", "url": "https://files.pythonhosted.org/packages/c1/72/432b4d7c51122e840c3aa9e2dfc5c50e2409adadba9bf10e1b851767f945/pptgen-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1ddcc9a4f5f28b5e9a5d8e05eb4cf211", "sha256": "0844c6635087ddceeafb23c4ec0f8297773545dde18d4487e28f61a7a453d4e1" }, "downloads": -1, "filename": "pptgen-0.2.1.tar.gz", "has_sig": false, "md5_digest": "1ddcc9a4f5f28b5e9a5d8e05eb4cf211", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 49871, "upload_time": "2017-11-01T11:19:58", "url": "https://files.pythonhosted.org/packages/4a/6b/18d08d1cd9aadaab471c512d83a9ab7ceb3b9dc0f823d85284de31ef92d9/pptgen-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5a982ce6a6c86e6396661f2ffbd56020", "sha256": "9d523ff9fec41224311ba1710c1617019664114e900c314f832d8b7e35d29fbe" }, "downloads": -1, "filename": "pptgen-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5a982ce6a6c86e6396661f2ffbd56020", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 51971, "upload_time": "2017-11-01T11:19:55", "url": "https://files.pythonhosted.org/packages/c1/72/432b4d7c51122e840c3aa9e2dfc5c50e2409adadba9bf10e1b851767f945/pptgen-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1ddcc9a4f5f28b5e9a5d8e05eb4cf211", "sha256": "0844c6635087ddceeafb23c4ec0f8297773545dde18d4487e28f61a7a453d4e1" }, "downloads": -1, "filename": "pptgen-0.2.1.tar.gz", "has_sig": false, "md5_digest": "1ddcc9a4f5f28b5e9a5d8e05eb4cf211", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 49871, "upload_time": "2017-11-01T11:19:58", "url": "https://files.pythonhosted.org/packages/4a/6b/18d08d1cd9aadaab471c512d83a9ab7ceb3b9dc0f823d85284de31ef92d9/pptgen-0.2.1.tar.gz" } ] }