Python80 [Python] KivyMD - MDIcon 이번에는 Icon에 대해 살펴보겠습니다. Material Design에서 제공하는 아이콘들을 쉽게 가져다 쓸 수 있어요. 아이콘의 종류와 이름은 아래 링크를 참고해주세요. https://materialdesignicons.com/ MDIcon 기본적인 아이콘 사용법은 다음과 같습니다. from kivymd.app import MDApp from kivymd.uix.boxlayout import MDBoxLayout from kivymd.uix.label import MDIcon class MainApp(MDApp): def build(self): self.theme_cls.theme_style = "Dark" self.theme_cls.primary_palette = "Orange" layout = MD.. 2022. 9. 28. [Python] KivyMD - MDLabel 이번엔 가장 흔하게 사용되는 label widget에 대해 살펴보겠습니다. 기능이 많아서 모든 기능을 설명하기 보단 많이 쓰일 몇 가지만 보여 드리겠습니다. MDLabel 기본적으로 text property를 사용해서 메세지를 출력할 수 있어요. from kivymd.app import MDApp from kivymd.uix.boxlayout import MDBoxLayout from kivymd.uix.label import MDLabel class MainApp(MDApp): def build(self): self.theme_cls.theme_style = "Dark" self.theme_cls.primary_palette = "Orange" layout = MDBoxLayout(orientation.. 2022. 9. 27. [Python] KivyMD를 사용하여 GUI application 만들기 KivyMD는 Kivy framework기반의 GUI 개발에 도움을 주는 framework입니다. MD는 Material Design을 뜻합니다. 이번 포스팅에서는 Python을 활용하여 간단한 사용법을 알아보겠습니다. Installation pip를 사용하여 다음의 명령으로 간단히 설치를 할 수 있습니다. $ pip install kivymd 이제 사용 준비는 모두 끝났습니다. 첫 번째 앱 만들기 간단한 코드로 첫 번째 application을 만들어 보겠습니다. from kivymd.app import MDApp from kivymd.uix.label import MDLabel class MainApp(MDApp): def build(self): return MDLabel(text="Hello, Wor.. 2022. 9. 9. [Python] Using PostgreSQL In this posting, we will check out how to use PostgreSQL with Python on MAC. Installation We can simply install PostgreSQL using Homebrew. $ brew install postgresql Then, the default DB named postgres is initialized. You can restart the service at any time with the below command. This is the official guide. https://www.postgresqltutorial.com/postgresql-getting-started/install-postgresql-macos/ h.. 2022. 5. 19. [Python] Using Telegram Bot API Let's make a telegram chatbot using Python. Creating ChatBot Let's assume that you are using Telegram. If you add BotFather, you can see it below. If you scroll the menu, you can see the all available commands. Let's select the "Create a new bot" menu (/newbot command). Now, give the name of the bot and username. Then, the telegram will give you the API key. The token looks like this. 123456:ABC.. 2022. 5. 13. [Python] Usage of .env .env file is commonly used for configuration. Python also has 3rd party library for this. Installation It can be installed by pip. $ pip install python-dotenv Create .env File .env file consists of key-value pair. # .env TEST=test TEST_URL=${TEST}.com You can expand the config using ${} syntax. TEST1="test string" TEST2="Test\nString" You can use a value as multiple lines using escape characters.. 2022. 4. 23. [Python] Pandas Course on Kaggle - 6 This is the solution of pandas course (Renaming and Combining) on Kaggle site. 1. Rename Columns renamed = reviews.rename(columns={'region_1': 'region', 'region_2': 'locale'}) 2. Rename an Index reindexed = reviews.rename_axis('wines', axis='rows') 3. Combine Data Frames combined_products = pd.concat([gaming_products, movie_products]) 4. Combine Data Frames by Index powerlifting_combined = power.. 2022. 1. 22. [Python] Pandas Course on Kaggle - 5 This is the solution of pandas course (Data Types and Missing Values) on Kaggle site. 1. Get Data Type of Column dtype = reviews.points.dtype # or dtype = reviews["points"].dtype 2. Change Data Type of Column point_strings = reviews.points.astype(str) # or point_strings = reviews.points.astype('str') # or point_strings = reviews["points"].astype(str) # or point_strings = reviews["points"].astype.. 2022. 1. 21. [Python] Pandas Course on Kaggle - 4 This is the solution of pandas course (Grouping and Sorting) on Kaggle site. 1. Group by Column reviews_written = reviews.groupby('taster_twitter_handle').size() # or reviews_written = reviews.groupby('taster_twitter_handle') .taster_twitter_handle .count() # or reviews_written = reviews.groupby("taster_twitter_handle")[ "taster_twitter_handle" ].count() 2. Group by Column and Sort by Index best.. 2022. 1. 20. [Python] Pandas Course on Kaggle - 3 This is the solution of pandas course (Summary Functions and Maps) on Kaggle site. 1. median() Function median_points = reviews.points.median() # or median_points = reviews["points"].median() 2. unique() Function countries = reviews.country.unique() # or countries = reviews["country"].unique() 3. value_counts() Function reviews_per_country = reviews.country.value_counts() # or reviews_per_countr.. 2022. 1. 19. [Python] Pandas Course on Kaggle - 2 This is the solution of pandas course (Indexing, Selecting & Assigning) on Kaggle site. 1. Select the Column desc = reviews["description"] # or desc = reviews.description 2. Select the Column and Row first_description = reviews["description"][0] # or first_description = reviews.description[0] # or first_description = reviews.description.loc[0] # or first_description = reviews.description.iloc[0].. 2022. 1. 17. [Python] Pandas Course on Kaggle - 1 This is the solution of pandas course (Creating, Reading and Writing) on Kaggle site. Setup import pandas as pd 1. Create a DataFrame fruits = pd.DataFrame( {"Apples": [30], "Bananas": [21]} ) 2. Create a DataFrame with Index fruit_sales = pd.DataFrame( {"Apples": [35, 41], "Bananas": [21, 34]}, index=["2017 Sales", "2018 Sales"] ) 3. Create a Series ingredients = pd.Series( ["4 cups", "1 cup", .. 2022. 1. 15. 이전 1 2 3 4 5 6 7 다음