<jupyter_start><jupyter_text>Plotter **Author:** [<NAME>](https://github.com/ndleah)  Description An automation program to plot data with different visualisations by user selections  Requirement<jupyter_code>!pip install chart_studio
!pip install cufflinks<jupyter_output>Requirement already satisfied: chart_studio in c:\users\leah nguyen\anaconda3\lib\site-packages (1.1.0)
Requirement already satisfied: plotly in c:\users\leah nguyen\anaconda3\lib\site-packages (from chart_studio) (5.1.0)
Requirement already satisfied: retrying>=1.3.3 in c:\users\leah nguyen\anaconda3\lib\site-packages (from chart_studio) (1.3.3)
Requirement already satisfied: requests in c:\users\leah nguyen\anaconda3\lib\site-packages (from chart_studio) (2.24.0)
Requirement already satisfied: six in c:\users\leah nguyen\anaconda3\lib\site-packages (from chart_studio) (1.15.0)
Requirement already satisfied: tenacity>=6.2.0 in c:\users\leah nguyen\anaconda3\lib\site-packages (from plotly->chart_studio) (7.0.0)
Requirement already satisfied: idna<3,>=2.5 in c:\users\leah nguyen\anaconda3\lib\site-packages (from requests->chart_studio) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\leah nguyen\anaconda3\lib\site-packages (from requests->chart_studio) (2020.6.20)
Re[...]<jupyter_text>Import libraries<jupyter_code>import numpy as np
import pandas as pd
import chart_studio.plotly as pl
import plotly.offline as po
import cufflinks as cf<jupyter_output><empty_output><jupyter_text>Setting cufflinks to offline mode<jupyter_code>po.init_notebook_mode(connected = True)
cf.go_offline()<jupyter_output><empty_output><jupyter_text>Define automation functions  Differentcreate data options using function ```createdata```<jupyter_code>def createdata(data):
    if(data == 1):
        x = np.random.rand(100, 5)
        df1 = pd.DataFrame(x, columns = ['A', 'B', 'C', 'D', 'E'])
    elif(data == 2):
        x = [0,0,0,0,0]
        r1 = [0,0,0,0,0]
        r2 = [0,0,0,0,0]
        r3 = [0,0,0,0,0]
        r4 = [0,0,0,0,0]
        print('Enter the values for columns ')
        i = 0
        for i in (0,1,2,3,4):
            x[i] = input()
            i = i + 1
        print('Enter the values for first row ')
        i = 0
        for i in (0,1,2,3,4):
            r1[i] = int(input())
            i = i + 1
        print('Enter the values for second row ')
        i = 0
        for i in (0,1,2,3,4):
            r2[i] = int(input())
            i = i + 1
        print('Enter the values for third row ')
        i = 0
        for i in (0,1,2,3,4):
            r3[i] = int(input())
            i = i + 1
        print('Enter the values for forth row ')
        i = 0
        for i in (0,1,2,3,4):
            r4[i] = int(input())
            i = i + 1
        df1= pd.DataFrame([r1, r2, r3, r4], columns = x)
    elif(data == 3):
        file = input('Enter the file name ')
        x = pd.read_csv(file)
        df1 = pd.DataFrame(x)
    else:
        print('Dataframe creation failed, please enter in between 1 to 3 and try ')
    return df1<jupyter_output><empty_output><jupyter_text>Plotting all columns option using function ```plotter```<jupyter_code>def plotter(plot):
    if(plot == 1):
        finalplot = df1.iplot(kind = 'scatter')
    elif(plot == 2):
        finalplot = df1.iplotfinalplot = df1.iplot(kind = 'scatter', mode = 'markers', symbol = 'x', colorscale = 'paired')
    elif(plot == 3):
        finalplot = df1.iplot(kind = 'bar')
    elif(plot == 4):
        finalplot = df1.iplot(kind = 'hist')
    elif(plot == 5):
        finalplot = df1.iplot(kind = 'box')
    elif(plot == 6):
        finalplot = df1.iplot(kind = 'surface')
    else:
        finalplot = print('Select only between 1 to 7')
    return finalplot<jupyter_output><empty_output><jupyter_text>Plotting by selecting specific columns using function ```plotter2```<jupyter_code>def plotter2(plot):
    col = input('Enter the number of columns you want to plot by selecting only 1, 2 or 3')
    col = int(col)
    if(col == 1):
        coln = input('Enter the column you want to plot by selecting any column from dataframe head')
        if(plot == 1):
            finalplot = df1[coln].iplot(kind = 'scatter')
        elif(plot == 2):
            finalplot = df1[coln].iplot(kind = 'scatter', mode = 'markers', symbol = 'x', colorscale = 'paired')
        elif(plot == 3):
            finalplot = df1[coln].iplot(kind = 'bar')
        elif(plot == 4):
            finalplot = df1[coln].iplot(kind = 'hist')
        elif(plot == 5):
            finalplot = df1[coln].iplot(kind = 'box')
        elif(plot == 6 or plot == 7):
            finalplot = print("Bubble plot and surface plot require more than one column arguements")
        else:
            finalplot = print('Select only between 1 to 7')               
    elif(col == 2):
        print('Enter the columns you want to plot by selecting from dataframe head')
        x = input('First column')
        y = input('Second column')
        if(plot == 1):
            finalplot = df1[[x, y]].iplot(kind = 'scatter')
        elif(plot == 2):
            finalplot = df1[[x, y]].iplot(kind = 'scatter', mode = 'markers', symbol = 'x', colorscale = 'paired')
        elif(plot == 3):
            finalplot = df1[[x, y]].iplot(kind = 'bar')
        elif(plot == 4):
            finalplot = df1[[x, y]].iplot(kind = 'hist')
        elif(plot == 5):
            finalplot = df1[[x, y]].iplot(kind = 'box')
        elif(plot == 6):
            finalplot = df1[[x, y]].iplot(kind = 'surface')
        elif(plot == 7):
            size = input('Please enter the size column for bubble plot')
            finalplot = df1.iplot(kind = 'bubble', x=x, y=y, size=size)
        else:
            finalplot = print('Select only between 1 to 7')              
    elif(col == 3):
        print('Enter the columns you want to plot')
        x = input('First column')
        y = input('Second column')
        z = input('Third column')
        if(plot == 1):
            finalplot = df1[[x, y, z]].iplot(kind = 'scatter')
        elif(plot == 2):
            finalplot = df1[[x, y, z]].iplot(kind = 'scatter', mode = 'markers', symbol = 'x', colorscale = 'paired')
        elif(plot == 3):
            finalplot = df1[[x, y, z]].iplot(kind = 'bar')
        elif(plot == 4):
            finalplot = df1[[x, y, z]].iplot(kind = 'hist')
        elif(plot == 5):
            finalplot = df1[[x, y, z]].iplot(kind = 'box')
        elif(plot == 6):
            finalplot = df1[[x, y, z]].iplot(kind = 'surface')
        elif(plot == 7):
            size = input('Please enter the size column for bubble plot')
            finalplot = df1.iplot(kind = 'bubble', x=x, y=y, z=z, size=size)
        else:
            finalplot = print('Select only between 1 to 7')
    else:
        finalplot = print('Please enter only 1, 2 or 3 and try again')
    return finalplot<jupyter_output><empty_output><jupyter_text>User selection with plotting table using function ```main```<jupyter_code>def main(cat):
    if(cat == 1):
        print('Select the type of plot you want to plot by writing 1 to 6')
        print('1. Line Plot')
        print('2. Scatter Plot')
        print('3. Bar Plot')
        print('4. Histogram')
        print('5. Box Plot')
        print('6. Surface Plot')
        plot = int(input())
        output = plotter(plot)
    elif(cat == 2):
        print('Select the type of plot you want to plot by writing 1 to 7')
        print('1. Line Plot')
        print('2. Scatter Plot')
        print('3. Bar Plot')
        print('4. Histogram')
        print('5. Box Plot')
        print('6. Surface Plot')
        print('7. Bubble Plot')
        plot = int(input())
        output = plotter2(plot)
    else:
        print('Please enter 1 or 2 and try again')<jupyter_output><empty_output><jupyter_text>Scripts for code executions 1. User choose the way they want data to be create:<jupyter_code>print('Select the type of data you need to plot(By writing 1, 2, or 3)')
print('1. Random data with 100 rows and 5 columns')
print('2. Customize dataframe with 5 colums and 4 rows')
print('3. Upload csv/json/txt file')
data = int(input())
df1 = createdata(data)<jupyter_output>Select the type of data you need to plot(By writing 1, 2, or 3)
1. Random data with 100 rows and 5 columns
2. Customize dataframe with 5 colums and 4 rows
3. Upload csv/json/txt file
1<jupyter_text>2. Inspecting the first 5 rows of the dataframe using ```head()``` function:<jupyter_code>print('Your DataFrame head is given below, check the columns to plot using cufflinks')
df1.head()<jupyter_output>Your DataFrame head is given below, check the columns to plot using cufflinks<jupyter_text>3. Selecting the number of columns they want to plot (whole table or selected columns only):<jupyter_code>print('What kind if plot you need, the complete data plot or columns plot')
cat = input('Press 1 for plotting all columns or press 2 for specifying columns to plot')
cat = int(cat)<jupyter_output>What kind if plot you need, the complete data plot or columns plot
Press 1 for plotting all columns or press 2 for specifying columns to plot1<jupyter_text>4. Choosing the plot types:<jupyter_code>main(cat)<jupyter_output>Select the type of plot you want to plot by writing 1 to 6
1. Line Plot
2. Scatter Plot
3. Bar Plot
4. Histogram
5. Box Plot
6. Surface Plot
1
{'fraction_non_alphanumeric': 0.13087956127399283, 'fraction_numerical': 0.02942417211558743, 'mean_word_length': 2.6277735271614384, 'pattern_counts': {'":': 0, '<': 42, '<?xml version=': 0, '>': 48, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '479281', 'license': 'MIT', 'n_tokens_mistral': 3235, 'n_tokens_neox': 3050, 'n_words': 948, 'path': 'Plotter/Plotter.ipynb', 'repo_name': '19lyaejin/python-mini-project', 'size': '9487'}