<jupyter_start><jupyter_text>💻IDS507 | Lab01Python introductionTA: 류 회 성(Hoe Sung Ryu) Concepts | 오늘 배울 개념---- 코랩 사용법을 익힌다. - 여러가지 형태의 데이터를 불러올 수 있다.  1. txt  1. csv  1. json  1. xlsx<jupyter_code>print('Hello World!')
!pip list | grep pandas
!pip install pandas<jupyter_output><empty_output><jupyter_text>📌1.드라이브 연동<jupyter_code>from google.colab import drive # 드라이브 연동
drive.mount('/content/gdrive')
!pwd  
import os
os.chdir('/content/gdrive/My Drive/IDS507-00/') # DataPath 설정 
!pwd<jupyter_output>/content/gdrive/My Drive/IDS507-00<jupyter_text>📌2. 여러가지 형태의 데이터<jupyter_code># 데이터 가져오기 
!git clone 
# .Txt file 일기 

txt_file_path = './2022_IDS507_Lab/data/CourseDescription.txt'

with open(txt_file_path,'r', encoding='utf-8') as f:
    lines = f.readlines()

for line in lines:
    print(line)
# txt 저장 
savename_txt = './2022_IDS507_Lab/data/sample_path.txt'
with open(savename_txt, "w") as f:
    f.write('샘플입니다.')
# txt 저장 
# savename_txt = './2022_IDS507_Lab/data/sample_path.txt'
with open(savename_txt, "a") as f:
    f.write('\n샘플입니다.22')
import this
import csv

filename = './2022_IDS507_Lab/data/sea_line.csv'
with open(filename,'r', encoding='utf-8') as f:
    reader = csv.reader(f)
    for row in reader:
        print(row)
import pandas as pd

df = pd.read_csv(filename)
df
import pandas as pd 

df_excel = pd.read_excel('./2022_IDS507_Lab/data/udong_2015.xlsx')
df_excel
df_excel = pd.read_excel('./2022_IDS507_Lab/data/udong_2015.xlsx',
                         skiprows=[0,1])
df_excel
# Make a get request to get the latest position of the international space station from the opennotify api.

import requests
import pandas as pd

response = requests.get("http://api.open-notify.org/astros.json") # request to get 
info= response.json() # info json 

people=info['people']
print(people)
df=pd.DataFrame(people)
df
info.keys()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13205537806176784, 'fraction_numerical': 0.041001064962726305, 'mean_word_length': 4.233983286908078, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '407579', 'license': 'Unlicense', 'n_tokens_mistral': 877, 'n_tokens_neox': 863, 'n_words': 171, 'path': 'Lab01.ipynb', 'repo_name': 'hoesungryu/2022_IDS507_Lab', 'size': '1878'}