SimonBiggs / scriptedforms

Quickly create live-update GUIs for Python packages using Markdown and simple HTML elements.
Apache License 2.0
508 stars 34 forks source link

plotting Dataframe #251

Closed Casyfill closed 6 years ago

Casyfill commented 6 years ago

I am trying to figure out how to plot dataframe the way it plots in the Jupyterlab, but so far I wasn't able to do anything but to print it... will appreciate any help

Casyfill commented 6 years ago

I figured out how to plot df to but wonder if there is any way to make it passive (non-interactive)

SimonBiggs commented 6 years ago

There definitely is. Could you use the following tags in your post to copy in the file you're trying to run?

~~~markdown
your file here
~~~
Casyfill commented 6 years ago

# Title

<section-start >
``````python
from business import load_data, analize
ready_to_report = False
fraud = ''
``````
</section-start >
<variable-string placeholder = "path to dataset" > data_path </variable-string >

# 2. Analysis
<section-button value = "Submit" condition = "data_path" >
``````python

data = load_data(data_path)
print(f'...data loaded. Working on {len(data)} records.')
fraud = analize(data)

if len(fraud) == 0:
    print('Hoorah! No fraud at all!')
else:
    print(f'Detected {len(fraud)} frodulent records\n\n')
    ready_to_report = True

``````
<variable-table>fraud</variable-table>
</section-button >
----
<section-button value = "to PDF" condition = "ready_to_report" >
``````python
print('PDF generated!')
``````
</section-button >
SimonBiggs commented 6 years ago

You can use IPython display to display tables using JupyterLab method.

Here is an example using IPython display as well as ScriptedForms table.

<section-start>

```python
from IPython.display import display
```

</section-start>

## Jupyter pandas DataFrame display

<section-button value="Create and show table">

```python
table = pd.DataFrame(data=[[1,2,3]], columns=['a', 'b', 'c'])
display(table)
```

</section-button>

## ScriptedForms DataFrame display set to readonly

<variable-table inputTypes="{'a': 'readonly', 'b': 'readonly', 'c': 'readonly'}">table</variable-table>
Casyfill commented 6 years ago

Thanks! worked perfectly

On Sat, Apr 21, 2018 at 11:48 PM Simon Biggs notifications@github.com wrote:

You can use IPython display to display tables using JupyterLab method.

```pythonfrom IPython.display import display```

Jupyter pandas DataFrame display

```pythontable = pd.DataFrame(data=[[1,2,3]], columns=['a', 'b', 'c'])display(table)```

ScriptedForms DataFrame display set to readonly

table

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SimonBiggs/scriptedforms/issues/251#issuecomment-383353264, or mute the thread https://github.com/notifications/unsubscribe-auth/ACjTpVhDOof3ED7_VyZ_ANvMDiwKGrkeks5tq_2VgaJpZM4TepV3 .

SimonBiggs commented 6 years ago

Good to hear :)

On Tue., 24 Apr. 2018, 12:09 am Philipp Kats, notifications@github.com wrote:

Thanks! worked perfectly

On Sat, Apr 21, 2018 at 11:48 PM Simon Biggs notifications@github.com wrote:

You can use IPython display to display tables using JupyterLab method.

```pythonfrom IPython.display import display```

Jupyter pandas DataFrame display

```pythontable = pd.DataFrame(data=[[1,2,3]], columns=['a', 'b', 'c'])display(table)```

ScriptedForms DataFrame display set to readonly

table

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/SimonBiggs/scriptedforms/issues/251#issuecomment-383353264 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ACjTpVhDOof3ED7_VyZ_ANvMDiwKGrkeks5tq_2VgaJpZM4TepV3

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/SimonBiggs/scriptedforms/issues/251#issuecomment-383588741, or mute the thread https://github.com/notifications/unsubscribe-auth/AGQVe8RcZFmU7qZ-hJAQnQMqM5TAnILVks5treCzgaJpZM4TepV3 .

SimonBiggs commented 6 years ago

How has ScriptedForms been treating you these last few days @Casyfill? Any suggestions to ease in new users?