일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Else
- Default X points
- For loops
- multiple lines
- __init__
- PANDAS
- variables
- PROJECT
- polynomial regression
- SQL
- break
- line width
- error
- Text Analytics
- MySQL
- matplotlib
- start exercise
- AS
- self parameter
- Text mining
- Github
- matplotlib.pyplot
- Python
- continue
- data distribution
- iterates
- machine learning
- train/test
- line color
- pie charts
- Today
- Total
목록Python (51)
Data Science Explorer
The following exercise was the one that I struggled and I have provided the solution as well. # 3. Write a function called print_pattern that takes integer number as an argument and prints following pattern if input number is 3, # * # ** # *** # if input is 4 then it should print # * # ** # *** # **** # Basically number of lines it prints is equal to that number. (Hint: you need to use two for l..

Built-In Math Functions The min() and max() functions can be used to find the lowest or highest value. Example x = min (3,10, 1) y = max (3,10, 1) print(x) print(y) The abs() function returns the absolute (positive value) of the specified number. Example x = abs(-8.25) print(x) The pow(x,y) function returns the value of x to the power of y. Example Return the value of 4 to the power of 2. x = po..

Python Dates A date in Python is not a data type of its own, but we can import a module named datetime to work with dates as date objects. Example Import the datetime module and display the current date. import dateime x = datetime.datetime.now() print(x) Date Output When we execute the code from the example above the result will be 2023-11-23 12:42:21.743477 which contained year, month, day, ho..

Think a module to be the same as a code library. A file containing a set of functions you want to include in your application. Create a module To create a module, you can save the code you want in a file with the file extension .py. Use a module When using a function from a module, use the syntax: module_name.function_name. Example import mymodule mymodule.greeting("Grace") Variables in module T..

Python Inheritance Inheritance allows us to define a class that inherits all the methods and properties from another class. Parent class (base class) is the class being inherited. Child class(derived class) is the class that inherits from another class. Example Create a class named Christmas with month, date properties. class Christmas: def__init__(self, month, date)" self.month = month self.dat..

A class is like an object constructor, blueprint for creating objects. Example Create a class named MyClass, with a proprty named x: class MyClass: x = 10 Create Object Example Create an object named p1, and print the value of x: p1 = MyClass () print (p1.x) The __init__() Function All classes have a function called __init__(), which is always executed when the class is being initiated. Example ..

To measure if the model is good or not, we can use a method called Train/Test. Train/Test It is for measuring the accuracy of the model, and it is called train/test because you separate the data set into two: training and testing set. Train the modeal means create the model and test the model means that the accuracy of the model. 80 % for training and 20 % for testing. Example Our data set illus..

Polynomial Regression It uses relationship between the variables x and y to find the best way to draw a line through the data points. import numpy import matplotlib.pyplot as plt x = [1,2,3,5,6,7,8,9,10,12,13,14,15,16,18,19,21,22] y = [100,90,80,60,60,55,60,65,70,70,75,76,78,79,90,99,99,100] mymodel = numpy.poly1d(numpy.polyfit(x, y, 3)) myline = numpy.linspace(1, 22, 100) plt.scatter(x, y) plt...
I was working on data cleaning and faced a struggle today. I had to duplicate each row and put it together and did not know how to deal with this. It took me a few hours to think and look up the ways to figure it out. Luckily I found the way out so I am going to show you how I did it! Step #1: You have to import the data. import pandas as pd ss = pd.read_csv('/content/총물량데이터.csv') print (ss) Ste..

Linear Regression It uses the relationship between the data-points to draw a straight line through all them. Example import matplotlib.pyplot as plt from scipy import stats x = [5,7,8,7,2,17,2,9,4,11,12,9,6] y = [99,86,87,88,111,86,103,87,94,78,77,85,86] slope, intercept, r, p, std_err = stats.linregress(x, y) def myfunc(x): return slope * x + intercept mymodel = list(map(myfunc, x)) plt.scatter..