๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ


Python

(75)
[Python] Pandas - Dataframe, NaN ๊ฐฏ์ˆ˜ def cnt_nan(df): """์ „์ฒด ํ–‰ NaN ๊ฐฏ์ˆ˜ ์กฐํšŒ :param pandas.DataFrame df: dataframe :return: dataframe Example: ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์‚ฌ์šฉํ•˜์„ธ์š”: >>> cnt_nan(df) """ df_len = len(df) df = pd.DataFrame(df.isnull().sum()) df['%'] = (df[0]/df_len)*100 # ๋น„์œจ df = df.rename(columns = {0: 'NaN cnt'}) return df
[Python] Pandas - Dataframe, json ์œผ๋กœ ๋ณ€๊ฒฝ import pandas as pd df = pd.DataFrame({'a':152.0054343543, 'b':0.0070054423423, 'c':-7.54543543E-07, 'd':2.50282237391414E-11}, index=[0]) df.to_json(orient='records', double_precision=15) - to_json ์ด์šฉ - ์†Œ์ˆซ์  ์ž๋ฆฌ์ˆ˜ ๊ธฐ๋ณธ 10์ž๋ฆฌ๋ผ์„œ 15๋กœ ์„ค์ •ํ•จ date_format https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_json.html pandas.DataFrame.to_json — pandas 1.1.0 documentation The time unit..
[Python] Pandas - Dataframe ์ „์ฒด ํ–‰, ์—ด ๋ณด๊ธฐ ์„ค์ • pd.set_option('display.max_columns', None) pd.set_option('display.max_rows', None)
[Python] Pandas - dataframe์˜ ํŠน์ • ๊ฐ’์„ NaN์œผ๋กœ ๋ณ€๊ฒฝ 0์„ NaN์œผ๋กœ ๋ณ€๊ฒฝ import numpy as np df = df.replace(0, np.NaN)
[jupyter] Terminal ์—†์• ๊ธฐ jupyter_notebook_config.py c.NotebookApp.terminals_enabled = False
Streamlit. The fastest way to build custom ML tools https://www.streamlit.io/ Streamlit — The fastest way to build custom ML tools Streamlit is an open-source app framework for Machine Learning and Data Science teams. Create beautiful data apps in hours, not weeks. All in pure Python. All for free. www.streamlit.io
[Python] Pandas - Dataframe ์ปฌ๋Ÿผ๋ช… ์กฐํšŒ df.columns # Import pandas package import pandas as pd df = pd.read_csv("a.csv") # iterating the columns for col in df.columns: print(col)
[Python] __name__ __name__ - ํŒŒ์ด์ฌ ์ž์ฒด์—์„œ ์‚ฌ์šฉํ•˜๋Š” ๋ณ€์ˆ˜ - ์ง์ ‘ ์‹คํ–‰ ๋œ ๊ฒฝ์šฐ๋Š” __name__ = __main__ - ๋‹ค๋ฅธ ํŒŒ์ผ์— ์ž„ํฌํŠธ ๋œ ๊ฒฝ์šฐ๋Š” ์ž์‹ ์˜ ํŒŒ์ผ๋ช…์ด ๋ฐ”์ธ๋”ฉ๋จ # ์ง์ ‘ ์‹คํ–‰ํ•œ ๊ฒฝ์šฐ๋งŒ ์‹คํ–‰ if __name__ == "__main__": print(__name__)