일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
- train/test
- line color
- Text mining
- Else
- Default X points
- continue
- start exercise
- SQL
- polynomial regression
- PROJECT
- pie charts
- line width
- self parameter
- multiple lines
- iterates
- Text Analytics
- AS
- __init__
- For loops
- machine learning
- matplotlib.pyplot
- MySQL
- break
- PANDAS
- error
- matplotlib
- Python
- variables
- Github
- data distribution
- Today
- Total
목록Python (51)
Data Science Explorer

Percentiles Percentiles are used in statistics to give you a number that describes the value that a given percent of the values are lower than. Example Use the Numpy percentile () method to find the percentiles. import numpy ages = [5,31,43,48,50,41,7,11,15,39,80,82,32,2,8,6,25,36,27,61,31] x = numpy.percentile(ages, 75) print(x) What is the 75. percentile? The answer is 43, meaning that 75 perc..

ModeResult(mode=11, count=1) In machine learning, there are three values. Mean: the average value Median: the mid point value Mode: the most common value Mean It is the average value, divide the sum by the number of the values Example (99+86+87+88+111+86+103+87+94+78+77+85+86) / 13 = 89.77 import numpy speed =[99,86,87,88,111,86,103,87,94,78,77,85,86] x = numpy.mean(speed) print(x) 89.7692307692..

Creating Pie Charts You can use the pie() function to draw pie charts Example import matplotlib.pyplot as plt import numpy as np y = np.array ([3, 6, 7, 1]) plt.pie(y) plt.show() Result Labels The label parameter must be an array with one label for each wedge. import matplotlib.pyplot as plt import numpy as np y = np.array([35, 25, 25, 15]) mylabels = ["Apples", "Bananas", "Cherries", "Dates"] p..

A histogram is a graph showing frequency districutions. We use the hist() function to create histogram. It will use an array of numbers to create historgram. Example import matplotlib.pyplot as plt import numpy as np x = np.random.normal(50, 10, 250) plt.hist(x) plt.show() Result

Creating bars Use bar() function to draw the bar graph. Example import matplotlib.pyplot as plt import numpy as np x = np.array(["Grace", "Momo", "Anas", "David"]) y = np.array([3, 8, 1, 10]) plt.bar(x,y) plt.show() Result Horizontal bars Use barh() to have your graph displayed horizontally. Example import matplotlib.pyplot as plt import numpy as np x = np.array(["A", "B", "C", "D"]) y = np.arra..

Creating Scatter Plots You can use the scatter() function to draw a scatter plot. Example import matplotlib.pyplot as plt import numpy as np x = np.array([1, 4, 6, 2]) y = np.array([4, 5, 2, 1]) plt.scatter(x, y) plt.show() Result Compare plots Example import matplotlib.pyplot as plt import numpy as np #day one, the age and speed of 13 cars: x = np.array([5,7,8,7,2,17,2,9,4,11,12,9,6]) y = np.ar..

The subplot() function takes three arguments that describe the layout of the figure. The layout is organized in rows and columns which are represented by the first and second agrument. Example plot.subplot(1, 3, 2) # the figure has 1 row, 3 columns and this plot is the second plot. Example import matplotlib.pyplot as plt import numpy as np x = np.array([0, 1, 2, 3]) y = np.array([3, 8, 1, 10]) p..

Add Grid Lines to a Plot You can use the grid() function to add grid lines to the plot. Example import matplotlib.pyplot as plt import numpy as np x = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125]) y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320, 330 plt.title ("The Office Watch Data") plt.xlabel("Average Pulse") plt.ylabel("Calorie Burnage") plt.plot(x, y) plt.grid() plt.sho..

Linestyle If you want to change the style of the line, you can use ls. Example import matplotlib.pyplot as plt import numpy as np ypoints = np.array ([2,6,7,0]) plt.plot(ypoints, ls = 'dotted') plt.show() Shorter Syntax linestyle can be written as ls. dotted can be written as :. dashed can be written as --. Line Styles Style Or 'solid' (default) '-' 'dotted' ':' 'dashed' '--' 'dashdot' '-.' 'Non..

Create Labels for a Plot You can use title(), xlabel(), and ylabel() functions give names for title, x-axis, and y-axis. Example import matplotlib.pyplot as plt import numpy as np x = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125]) y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320, 330]) plt.plot (x, y) plt.title("Heights Data") plt.xlabel("Average Height") plt.ylabel("Average W..