-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Dataframe docs update #693
docs: Dataframe docs update #693
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done 💪 I spotted some small mistakes, but it should be good.
docs/framework/dataframe.mdx
Outdated
}) | ||
``` | ||
|
||
```sh Polars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```sh Polars | |
```python Polars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☝️ ➕
docs/framework/dataframe.mdx
Outdated
}) | ||
``` | ||
|
||
```sh List of dictionaries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```sh List of dictionaries | |
```python List of dictionaries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☝️ ➕
docs/framework/dataframe.mdx
Outdated
|
||
A editable DataFrame is one whose content can change. Like static DataFrames, editable DataFrames use the **DataFrame** UI component. Unlike static tables, the DataFrame UI component is bound to an instance of `EditableDataframe`, a class provided by the Writer library. Changes to a `EditableDataframe` object will be immediately reflected in the DataFrame UI component that it is bound to. | ||
|
||
<Note>Note that the "f" in `EditableDataframe` is _not_ capitalized — it’s `EditableDataframe`, not `EditableDataFrame`!</Note> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FabienArcellier @madeindjs can we change to standard capitalization of DataFrame? (I find it weird too, but it is what it is)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samjulien @ajot @AccordionGuy in general, if you find yourself writing something like this, please provide feedback and we'll likely fix it on our end 😀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we can. I have used the class name of pandas. Dataframe or dataframe looks better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you'll change from EditableDataframe
to EditableDataFrame
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, bad reading for my comment on github. Ok for me to go to EditableDataFrame
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AccordionGuy we'll fix this on our end, can you please change docs to EditableDataFrame
and remove the <Note>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ramedina86 @FabienArcellier I've made the updates as requested and will let you folks know if I find potential issues like the capitalization of EditableDataframe
— I figured that there might be a good reason for the original capitalization, but I’ll ask next time!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @AccordionGuy 🙏🏻
Co-authored-by: Alexandre Rousseau <[email protected]>
Co-authored-by: Alexandre Rousseau <[email protected]>
Co-authored-by: Alexandre Rousseau <[email protected]>
Co-authored-by: Alexandre Rousseau <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few corrections needed and a little intro and conclusion cleanup
## Use a dataframe | ||
|
||
**a dataframe is simply added to the state**. A component like `dataframe` will be able to display it. | ||
**Writer Framework has two objects with the name _DataFrame_:** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add an intro sentence here to help people understand what they're trying to accomplish with dataframes?
The call to `wf.init_state()` adds the `DataFrame` to the application's `state` variable as the value of the `mydf` key. | ||
</Step> | ||
<Step title="Add a DataFrame component to the UI and bind it to the DataFrame data structure"> | ||
Add a DataFrame UI component to the user interface, then set its **Data** property to `@{`_dataframe_key_`}`, where _dataframe_key_ is the `state` variable key whose value refers to the `DataFrame` data structure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The underscores at the front and end of _dataframe_key_
add italics and break the code formatting, I'd remove them.
docs/framework/dataframe.mdx
Outdated
|
||
In the case of this example, `mydf` is the `state` variable key referring to the `DataFrame`, so set the **Data** property to `@{mydf}`. | ||
|
||
![DataFrame for static table example with properties panel open](images/dataframe_static_table_1.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This image is broken for me, might want to double check the URL against other docs. I think you need to add /framework to the front possibly but check out other examples.
docs/framework/dataframe.mdx
Outdated
}) | ||
``` | ||
|
||
```sh Polars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☝️ ➕
docs/framework/dataframe.mdx
Outdated
}) | ||
``` | ||
|
||
```sh List of dictionaries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☝️ ➕
docs/framework/dataframe.mdx
Outdated
|
||
In the case of this example, `mydf` is the `state` variable key referring to the `DataFrame`, so set the **Data** property to `@{mydf}`. | ||
|
||
![DataFrame for dynamic table example with properties panel open](images/dataframe_dynamic_table_1.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto on image URL being broken
}) | ||
``` | ||
```python | ||
state["mydf"].record_remove({"record_index": 2}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this is missing a conclusion or something to wrap this up and tell the user where to go next
To present a data table in Writer Framework, you create a `DataFrame` data structure in your code and then bind it to a UI Dataframe. | ||
|
||
|
||
## Displaying a static DataFrame |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please briefly discuss the options in the DataFrame component (e.g. sorting, downloading, searching) and link to the component documentation.
Updates look great @AccordionGuy! @ramedina86 @FabienArcellier this is ready for you all to review and merge! Once that's done we'll need to update the main mintlify.json in the docs repo -- happy to do it unless you already have that as part of your process, I know Fabien was looking at automating this. |
@FabienArcellier just bumping this for visibility once you're back from the holidays. Would love to finally get Dataframe documented! Thank you! |
I review and fix conflicts. It looks ok. I would advocate to explain on how to use # Subscribe this event handler to the `wf-dataframe-add` event
#
# more on : https://dev.writer.com/framework/dataframe
def on_record_add(state, payload):
payload['record']['sales'] = 0 # default value inside the dataframe
state['mydf'].record_add(payload) # should contain an EditableDataFrame instance @samjulien if it looks ok for you, I will merge. Let me know |
@samjulien I haven't work on the topic of automatic table of content generation. It would focus on generated contents (components and later on workflow blocks), not on editorialized pages as Dataframe or ai-modules. |
Thanks @FabienArcellier! Let's go ahead with this -- I've added a Jira ticket to the Docs & DX board for making your suggested updates in the next iteration of this doc. Whenever it's released I'll manually add to the main Mintlify nav in the docs repo. |
Here’s the first of many rapid updates to the documentation for DataFrame. This one covers displaying DataFrames and the methods for the
EditableDataframe
class.