sketch : Python Library for code generation
This enables pandas working is easier with plain english.
Let us see how We with a walkthrough?
1. open vscode ide
2. in terminal
go to your users/yourname directory
3. install python plugin in vs code
4. in terminal install sketch by
pip install sketch
5. install jupyter notebook plugin
6. install ipky python kernel (if not already installed)
7. create jupter notebook file
enter the following in the code text box
import pandas as pd
import sketch
df = pd.read_csv("https://raw.githubusercontent.com/Sven-Bo/datasets/master/supermarket_sales.csv") df.info()
After entering the code you will get screen similar to the aboveWhen you f10 button or click play(run) button you will get the output as below the code:sketch demo
create many code blocks by clicking code+ in the above screen on the top left corner of this jupyter notebook windowwindow:
enetry one by one the following in the code blocks and run by pressing play button
df.sketch.ask("What is this dataset about?")you will get outputs similar to this as follows:
df.sketch.ask("Can you give me friendly names and single sentence descriptions of each column? (format output as HTML List)")outputs similar to the following screenshots
df.sketch.ask("What interesting analysis could we perform?")output
You will code like this.df.sketch.howto("Analyze the relationship between rating and total sale")output
You will get code similar the above. You have to add code box and then copy the above code in to this code box.and then dont forget to install matplotlib bypip install matplotlib command in the terminal or command prompt
run to get the output similar to thisdf.sketch.howto("Calculate the product lines with the highest profits")output will be code assist text like this.
copy the below text to code block and runto get the output:
copy the above code in to new code block
df.sketch.howto("Create a plot to show sales by gender")
copy the aboce assist code given by sketch to new code block
run the above code to get output similar to the below:
df.sketch.howto("Create a plot to show sales by month")run to assist code from sketch by mere english prompts.copy the above inside code box as shown belowto get the output similar to thisdf.sketch.howto("Using Plotly, plot the total sales by each hour of the day")run to get code
copy the above code in the code block:run the above code to get output as similar below:
Please dont forget to install plotly by pip install plotly
Please consider this above as exercise see the ouput.
Happy Learning & coding!
No comments:
Post a Comment