🐍Python

    [Pandas] Pandas05 - MPG Cars 풀이

    MPG CarsIntroduction:The following exercise utilizes data from UC Irvine Machine Learning RepositoryStep 1. Import the necessary librariesIn [1]:import pandas as pd Step 2. Import the first dataset cars1 and cars2.Step 3. Assign each to a variable called cars1 and cars2In [3]:url1 = 'https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/05_Merge/Auto_MPG/cars1.csv' url2 = 'https:/..

    [Pandas] Pandas04 - US Crime Rates 풀이

    United States - Crime Rates - 1960 - 2014Introduction:This time you will create a dataSpecial thanks to: https://github.com/justmarkham for sharing the dataset and materials.Step 1. Import the necessary librariesIn [1]:import pandas as pd Step 2. Import the dataset from this address.Step 3. Assign it to a variable called crime.In [2]:url = 'https://raw.githubusercontent.com/guipsamora/pandas_exe..

    [Pandas] Pandas04 - Student Alcohol Consumption 풀이

    Student Alcohol ConsumptionIntroduction:This time you will download a dataset from the UCI.Step 1. Import the necessary librariesIn [12]:import pandas as pd import numpy as np Step 2. Import the dataset from this address.Step 3. Assign it to a variable called df.In [3]:url = 'https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/04_Apply/Students_Alcohol_Consumption/student-mat.cs..

    [Pandas] Pandas03 - Regiment 풀이

    RegimentIntroduction:Special thanks to: http://chrisalbon.com/ for sharing the dataset and materials.Step 1. Import the necessary librariesIn [16]:import pandas as pd Step 2. Create the DataFrame with the following values:In [17]:raw_data = {'regiment': ['Nighthawks', 'Nighthawks', 'Nighthawks', 'Nighthawks', 'Dragoons', 'Dragoons', 'Dragoons', 'Dragoons', 'Scouts', 'Scouts', 'Scouts', 'Scouts']..

    [Pandas] Pandas03 - Occupation 풀이

    OccupationIntroduction:Special thanks to: https://github.com/justmarkham for sharing the dataset and materials.Step 1. Import the necessary librariesIn [1]:import pandas as pd Step 2. Import the dataset from this address.Step 3. Assign it to a variable called users.In [13]:url = 'https://raw.githubusercontent.com/justmarkham/DAT8/master/data/u.user' users = pd.read_csv(url,sep='|',index_col='use..

    [Numpy] Numpy 연습문제 61~70

    61. Find the nearest value from a given value in an array (★★☆)(hint: np.abs, argmin, flat)In [9]:Z = np.random.uniform(0,1,10) z = 0.5 m = Z.flat[np.abs(Z-z).argmin()] print(m) # flat은 펴주는 것 0.5425169605826707 62. Considering two arrays with shape (1,3) and (3,1), how to compute their sum using an iterator? (★★☆)(hint: np.nditer)In [31]:A = np.arange(3).reshape(1,3) B = np.arange(3).reshape(3,1..