Data Science and Data Proicessing

지금 당장 사용해야하는 프로그래머를위한 과소 평가 된 5 가지 앱

들어 본 적이 없더라도 벨트 아래에 있어야 할 도구가 있습니다.

Image for post
~의 사진조슈아 레 데콥의 위에Unsplash

소개

개발자가 앱과 소프트웨어를 만들기 위해 수많은 앱과 소프트웨어를 사용하는 방식은 아이러니합니다. 시간이 지남에 따라 워크 플로의 일부로 선택한 몇 가지 도구에 대한 강력한 선호도를 개발했습니다. 그러나 일부 소프트웨어가 표준이되었다고해서 항상 다른 소프트웨어를 주시해서는 안되는 것은 아닙니다! 다음은 내가 매일 사용하려고 시도한 가장 과소 평가되었지만 엄청나게 유용한 앱 중 일부이며 여러분도 사용해야한다고 생각합니다!

목차

  1. Ungit
  2. Termius
  3. 기민함
  4. 뵤부
  5. 스페이스 데스크

1. Ungit

명령 줄 인터페이스를 통해 Git 리포지토리를 관리하는 것은 악명 높을 정도로 어렵습니다. 모든 사람이 사실을 알고 있습니다. 그리고 20 개 정도의 다른 브랜치가있는 프로젝트를 열면 모든 브랜치를 통해 최근 커밋을 따라 가기가 어렵습니다.분기 모델. 더 나쁜 것은 처음으로 Git을 사용하여 버전 제어를 수행하려는 초보자입니다. ㅏCLI는 사용자가 Git의 진정한 의미를 이해하도록 할 수 없습니다.

UngitGit 저장소 관리를위한 직관적 인 GUI로 이러한 모든 문제를 해결합니다.

Ungit커밋 및 분기의 거미줄처럼 저장소를 나타냅니다. 작동 방식은 다음과 같습니다.

Image for post
ungit 살펴보기
Image for post
ungit에서 새 커밋 만들기
Image for post
ungit의 동일한 저장소에서 다른 분기 간 전환 (체크 아웃)

2. Termius

격리 시간 (적어도이 글을 쓰는 시점)이므로 모두가 집에서 합리적으로 일하고 있습니다. 직장에서 컴퓨터 나 서버에 액세스해야하는 경우 어떻게합니까? 글쎄, 당신은 서버에 SSH를 사용하여 해당 컴퓨터의 터미널에 대한 액세스 권한을 부여합니다. 이것은 간단한 것으로 할 수 있지만ssh명령, 왜 안돼스타일Termius?

Image for post
원격 서버, Termius에서`sl` 실행 😎
Termius에 대한 사용자 지정 옵션

3. 기민성

터미널에 대해 말하면기민함내 로컬 터미널 에뮬레이터로 이동합니다. Windows, macOS 및 많은 Linux 배포에서 지원됩니다. 최고의 판매 포인트 중 하나기민함그것입니다GPU 가속 지원. 이 때문에 터미널 에뮬레이터 제작자는대체 제품에 비해 놀랍도록 빠른 성능을 자랑합니다..

Image for post

4. 뵤부

이건 아니야기술적으로앱이나 소프트웨어이지만 개인적으로 워크 플로에서이 기능을 많이 사용했기 때문에이 기사에서이 기능을 소개해야한다고 느꼈습니다.It’s a terminal multiplexer & window manager— 사실, 실제로는 래퍼입니다.tmux및 / 또는GNU 화면,들어 보셨을 멀티플렉서입니다. 원격 서버 (Termius 😉)에서 작업 중이거나 자신의 컴퓨터에서 여러 터미널 창을 자주 여는 경우뵤부확실히 당신을위한 것입니다.

Image for post
Byobu를 사용하여 한 곳에서 터미널 세션 / 인스턴스 처리
Image for post
Byobu의기본 상태 표시 줄
Image for post
Byobu의 분할 창

5. 스페이스 데스크

결론

오늘부터 사용해야하는 과소 평가 된 앱 / 소프트웨어에 대한 내용입니다! 내가 나열한 것에 대한 생각이나 대안이 있으면 언제든지 알려 주시고 아래에서 대화를 시작하세요.언제나처럼 즐거운 코딩입니다. 여러분!

5 Underrated Apps for Programmers You Should Use Right Now

Here are some tools you should have under your belt, even if you’ve never heard of them!

Jul 6 · 6 min read

Introduction

It’s ironic how developers use a plethora of apps and software to make…apps and software. Over time, we have developed strong preferences over a select few tools as part of their workflow. However, just because some pieces of software have become the norm that doesn’t mean we shouldn’t always be on the lookout for others! Here are some of the most underrated yet insanely useful apps that I’ve tried to use on a daily basis, and that I think you should use too!

Table of Contents

  1. Ungit
  2. Termius
  3. Alacritty
  4. Byobu
  5. Spacedesk

1. Ungit

It is notoriously difficult to manage your Git repository through the command line interface — everyone knows that for a fact. And when you have a project open with 20 or so different branches, it’s hard to keep up with recent commits through all of them, let alone follow a branching model. Even worse are beginners trying to use Git for their first time to perform version control; a CLI can’t let users comprehend what Git really is supposed to be.

Ungit solves all of these issues with an intuitive GUI for managing Git repos.

Ungit represents your repo like a spider web of commits and branches. Here’s what it’ll look like in action:

Image for post
A quick look into ungit
Image for post
Creating a new commit in ungit
Image for post
Switching (Checking out) between different branches in the same repo in ungit

2. Termius

It’s quarantine time (at least at the time of writing this), so everybody is reasonably working from home. What if you need to access a computer or server at your workplace? Well, you would SSH into the server, giving yourself access to the terminal on that machine. Although this is doable with a simple ssh command, why not do it in style with Termius?

Image for post
Running `sl`, on a remote server, on Termius 😎
Customization options for Termius

3. Alacritty

Talking about terminals, Alacritty would be my go-to local terminal emulator. It is supported in Windows, macOS, and many linux distributions. One of the best selling points of Alacritty is its support for GPU acceleration. Because of this, the makers of the terminal emulator boast blazing fast performance compared to alternatives.

Image for post

4. Byobu

This isn’t technically an app or piece of software, but I felt compelled to feature it in this article because I’ve personally used this so much in my workflow. It’s a terminal multiplexer & window manager— in fact, it’s actually a wrapper over tmux and/or GNU screen, which are multiplexers you might’ve heard of. If you’re either working on a remote server (on Termius 😉) or find yourself frequently opening multiple terminal windows on your own machine, Byobu is definitely for you.

Image for post
Using Byobu to handle terminal sessions/instances in one place
Image for post
Byobu’s default status bar
Image for post
Splitting panes in Byobu

5. Spacedesk

Conclusion

That’s about it for some underrated apps/software you should start using today! If you have thoughts or some alternatives to ones I’ve listed feel free to let me know and start a conversation below. As always, happy coding, everybody!

Rank Game Publisher
1 리니지M NCSOFT
2 리니지2M NCSOFT
3 Genshin Impact miHoYo Limited
4 바람의나라: 연 NEXON Company
5 기적의 검 4399 KOREA
6 V4 NEXON Company
7 KartRider Rush+ NEXON Company
8 R2M Webzen Inc.
9 뮤 아크엔젤 Webzen Inc.
10 라이즈 오브 킹덤즈 LilithGames
11 Pmang Poker : Casino Royal NEOWIZ corp
12 블레이드&소울 레볼루션 Netmarble
13 A3: 스틸얼라이브 Netmarble
14 AFK 아레나 LilithGames
15 슬램덩크 DeNA HONG KONG LIMITED
16 가디언 테일즈 Kakao Games Corp.
17 라그나로크 오리진 GRAVITY Co., Ltd.
18 그랑삼국 YOUZU(SINGAPORE)PTE.LTD.
19 리니지2 레볼루션 Netmarble
20 일루전 커넥트 ChangYou
21 FIFA ONLINE 4 M by EA SPORTS™ NEXON Company
22 PUBG MOBILE PUBG CORPORATION
23 Roblox Roblox Corporation
24 컴투스프로야구2020 Com2uS
25 한게임 포커 NHN BIGFOOT
26 스테리테일 4399 KOREA
27 랑그릿사 ZlongGames
28 검은사막 모바일 PEARL ABYSS
29 FIFA Mobile NEXON Company
30 Summoners War Com2uS
31 마구마구 2020 Netmarble
32 Brawl Stars Supercell
33 Epic Seven Smilegate Megaport
34 Gardenscapes Playrix
35 메이플스토리M NEXON Company
36 케페우스M Ujoy Games
37 Age of Z Origins Camel Games Limited
38 리니지M(12) NCSOFT
39 뮤오리진2 Webzen Inc.
40 프린세스 커넥트! Re:Dive Kakao Games Corp.
41 Lord of Heroes CloverGames
42 황제라 칭하라 Clicktouch Co., Ltd.
43 Cookie Run: OvenBreak - Endless Running Platformer Devsisters Corporation
44 동방불패 모바일 Perfect World Korea
45 Rise of Empires: Ice and Fire Long Tech Network Limited
46 명일방주 Yostar Limited.
47 Lords Mobile: Kingdom Wars IGG.COM
48 Clash of Clans Supercell
49 Homescapes Playrix
50 MLB 9 Innings 20 Com2uS

프로그램 작성

🔝 시간을 절약하는 유용한 Python 스 니펫 29 가지

실제로 개발자로서의 시간을 절약 해주는 가장 좋아하는 29 개의 Python 스 니펫이 있습니다.

Top 29 Useful Python Snippets That Save You Time
출처:Pixabay

Python은 데이터 과학 및 기계 학습, 웹 개발, 스크립팅, 자동화 등에서 많은 사람들이 사용하는 가장 인기있는 언어 중 하나입니다. 이 인기의 이유 중 하나는 단순성과 학습 용이성입니다.

이 글을 읽고 있다면 이미 Python을 사용하고 있거나 적어도 관심이있을 가능성이 높습니다.

이 기사에서는 놀랍도록 빠르게 이해하고 익힐 수있는 29 개의 짧은 코드 스 니펫을 간략히 살펴 보겠습니다. 가다!

👉 1. 고유성 확인

다음 메소드는 주어진 목록에 중복 항목이 있는지 확인합니다. 속성을 사용합니다.세트()목록에서 중복 항목을 제거합니다.

👉 2. 철자

이 방법은 두 문자열이 애너그램인지 확인하는 데 사용할 수 있습니다. Anagram은 다른 단어 나 구의 문자를 다시 정렬하여 형성 한 단어 나 구로, 일반적으로 모든 원래 문자를 정확히 한 번 사용합니다.

👉 3. 메모리

그리고 이것은 객체의 메모리 사용량을 확인하는 데 사용할 수 있습니다.

👉 4. 바이트 크기

이 메서드는 문자열의 길이를 바이트 단위로 반환합니다.

👉 5. 문자열을 N 번 인쇄

이 스 니펫은 문자열을 출력하는 데 사용할 수 있습니다.이를 위해 루프를 사용할 필요가 없습니다.

👉 6. 단어의 첫 글자를 크게 만듭니다.

그리고 여기에 레지스터가 있습니다. 스 니펫은 메소드를 사용합니다.표제()문자열의 각 단어를 대문자로 표시하려면 :

👉 7. 분리

이 메서드는 목록을 지정된 크기의 작은 목록으로 분할합니다.

👉 8. 거짓 값 제거

따라서 거짓 값 (그릇된,없음,0«»)를 사용하여 목록에서필터():

👉 9. 계산

다음 코드를 사용하여 2D 배열을 전치 할 수 있습니다.

👉 10. 체인 비교

한 줄에 모든 종류의 연산자를 사용하여 여러 비교를 수행 할 수 있습니다.

👉 11. 쉼표로 구분

다음 스 니펫을 사용하여 문자열 목록을 단일 문자열로 변환 할 수 있습니다. 여기서 목록의 각 항목은 쉼표로 구분됩니다.

👉 12. 모음 세기

이 방법은 모음 수를 계산합니다.( "a", "e", "i", "o", "u")문자열에서 발견 :

👉 13. 문자열의 첫 글자를 소문자로 변환

지정된 문자열의 첫 글자를 소문자로 변환하는 데 사용합니다.

👉 14. 앤티 앨리어싱

다음 방법은 재귀를 사용하여 잠재적으로 깊은 목록을 평면화합니다.

👉 15. 차이

이 방법은 첫 번째에있는 값만 유지하면서 두 반복 간의 차이를 찾습니다.

👉 16. 목록의 차이점

다음 메서드는이 함수를 두 목록의 각 요소에 적용한 후 두 목록의 차이를 반환합니다.

👉 17. 연결 함수 호출

한 줄에 여러 함수를 호출 할 수 있습니다.

👉 18. 중복 찾기

이 코드는 다음 사실을 사용하여 목록에 중복 값이 ​​있는지 확인합니다.세트()고유 한 값만 포함합니다.

👉 19. 두 개의 사전 결합

다음 방법을 사용하여 두 사전을 결합 할 수 있습니다.

👉 20. 두 목록을 사전으로 변환

이제 두 목록을 사전으로 변환 해 보겠습니다.

👉 21. ʻenumerate` 사용

스 니펫은 사용할 수있는 항목을 보여줍니다.세다()목록의 값과 인덱스를 모두 얻으려면 :

👉 22. 보낸 시간

특정 코드가 실행되는 데 걸리는 시간을 계산하는 데 사용합니다.

👉 23. 시도 / 다른

당신이 사용할 수있는그밖에블록의 일부로시험:

👉 24. 가장 자주 나타나는 요소

이 메서드는 목록에 나타나는 가장 빈번한 항목을 반환합니다.

👉 25. 회문

이 메서드는 주어진 문자열이 회문인지 확인합니다.

👉 26. if-else가없는 계산기

다음 스 니펫은 조건없이 간단한 계산기를 작성하는 방법을 보여줍니다.다른 경우라면:

👉 27. 셔플

이 코드는 목록의 항목 순서를 무작위로 지정하는 데 사용할 수 있습니다. 참고혼합제자리에서 일하고 반환없음:

👉 28. 값 변경

추가 변수없이 두 개의 변수를 교환하는 정말 빠른 방법 :

👉 29. 누락 된 키에 대한 기본값 가져 오기

이 코드는 찾고있는 키가 사전에 포함되지 않은 경우 기본값을 가져올 수있는 방법을 보여줍니다.

더 읽어보기

이 기사가 도움이 되었다면 아래의 💚 또는 👏 버튼을 클릭하거나 Facebook에서 기사를 공유하여 친구들도 도움을받을 수 있습니다.

내 이야기에서 더 :

PROGRAMMING

🔝Top 29 Useful Python Snippets 🔝That Save You Time

Here are my favorite 29 Python snippets that actually save me time as a developer

Top 29 Useful Python Snippets That Save You Time
Source: Pixabay

Python is one of the most popular languages ​​used by many in data science and machine learning, web development, scripting, automation, and more. One of the reasons for this popularity is its simplicity and ease of learning.

If you are reading this, you are most likely already using Python, or at least interested in it.

In this article, we’ll take a quick look at 29 short code snippets that you can understand and master incredibly quickly. Go!

👉 1. Checking for uniqueness

The next method checks if there are duplicate items in the given list. It uses a property set()that removes duplicate items from the list:

👉 2. Anagram

This method can be used to check if two strings are anagrams. An Anagram is a word or phrase formed by rearranging the letters of another word or phrase, usually using all the original letters exactly once:

👉 3. Memory

And this can be used to check the memory usage of an object:

👉 4. Size in bytes

The method returns the length of the string in bytes:

👉 5. Print the string N times

This snippet can be used to output a string nonce without the need to use loops for this:

👉 6. Makes the first letters of words large

And here is the register. The snippet uses a method title()to capitalize each word in a string:

👉 7. Separation

This method splits the list into smaller lists of the specified size:

👉 8. Removing false values

So you remove the false values ( False, None, 0and «») from the list using filter():

👉 9. Counting

The following code can be used to transpose a 2D array:

👉 10. Chain comparison

You can do multiple comparisons with all kinds of operators in one line:

👉 11. Separate with comma

The following snippet can be used to convert a list of strings to a single string, where each item from the list is separated by commas:

👉 12. Count the vowels

This method counts the number of vowels (“a”, “e”, “i”, “o”, “u”) found in the string:

👉 13. Converting the first letter of a string to lowercase

Use to convert the first letter of your specified string to lowercase:

👉 14. Anti-aliasing

The following methods flatten out a potentially deep list using recursion:

👉 15. Difference

The method finds the difference between the two iterations, keeping only the values ​​that are in the first:

👉 16. The difference between lists

The following method returns the difference between the two lists after applying this function to each element of both lists:

👉 17. Chained function call

You can call multiple functions on one line:

👉 18. Finding Duplicates

This code checks to see if there are duplicate values ​​in the list using the fact that set()it only contains unique values:

👉 19. Combine two dictionaries

The following method can be used to combine two dictionaries:

👉 20. Convert two lists to a dictionary

Now let’s get down to converting two lists into a dictionary:

👉 21. Using `enumerate`

The snippet shows what you can use enumerate()to get both values ​​and indices of lists:

👉 22. Time spent

Use to calculate the time it takes for a specific code to run:

👉 23. Try / else

You can use elseas part of a block try:

👉 24. The element that appears most often

This method returns the most frequent item that appears in the list:

👉 25. Palindrome

The method checks if the given string is a palindrome:

👉 26. Calculator without if-else

The following snippet shows how to write a simple calculator without the need for conditions if-else:

👉 27. Shuffle

This code can be used to randomize the order of items in a list. Note that shuffleworks in place and returns None:

👉 28. Change values

A really quick way to swap two variables without the need for an extra one:

👉 29. Get default value for missing keys

The code shows how you can get the default value if the key you are looking for is not included in the dictionary:

Read More

If you found this article helpful, click the💚 or 👏 button below or share the article on Facebook so your friends can benefit from it too.

More from my stories:

Rank Game Publisher
1 리니지M NCSOFT
2 리니지2M NCSOFT
3 Genshin Impact miHoYo Limited
4 바람의나라: 연 NEXON Company
5 기적의 검 4399 KOREA
6 V4 NEXON Company
7 KartRider Rush+ NEXON Company
8 R2M Webzen Inc.
9 뮤 아크엔젤 Webzen Inc.
10 라이즈 오브 킹덤즈 LilithGames
11 Pmang Poker : Casino Royal NEOWIZ corp
12 블레이드&소울 레볼루션 Netmarble
13 A3: 스틸얼라이브 Netmarble
14 AFK 아레나 LilithGames
15 슬램덩크 DeNA HONG KONG LIMITED
16 가디언 테일즈 Kakao Games Corp.
17 라그나로크 오리진 GRAVITY Co., Ltd.
18 그랑삼국 YOUZU(SINGAPORE)PTE.LTD.
19 리니지2 레볼루션 Netmarble
20 일루전 커넥트 ChangYou
21 FIFA ONLINE 4 M by EA SPORTS™ NEXON Company
22 PUBG MOBILE PUBG CORPORATION
23 Roblox Roblox Corporation
24 컴투스프로야구2020 Com2uS
25 한게임 포커 NHN BIGFOOT
26 스테리테일 4399 KOREA
27 랑그릿사 ZlongGames
28 검은사막 모바일 PEARL ABYSS
29 FIFA Mobile NEXON Company
30 Summoners War Com2uS
31 마구마구 2020 Netmarble
32 Brawl Stars Supercell
33 Epic Seven Smilegate Megaport
34 Gardenscapes Playrix
35 메이플스토리M NEXON Company
36 케페우스M Ujoy Games
37 Age of Z Origins Camel Games Limited
38 리니지M(12) NCSOFT
39 뮤오리진2 Webzen Inc.
40 프린세스 커넥트! Re:Dive Kakao Games Corp.
41 Lord of Heroes CloverGames
42 황제라 칭하라 Clicktouch Co., Ltd.
43 Cookie Run: OvenBreak - Endless Running Platformer Devsisters Corporation
44 동방불패 모바일 Perfect World Korea
45 Rise of Empires: Ice and Fire Long Tech Network Limited
46 명일방주 Yostar Limited.
47 Lords Mobile: Kingdom Wars IGG.COM
48 Clash of Clans Supercell
49 Homescapes Playrix
50 MLB 9 Innings 20 Com2uS

이 질문을하면 당신이 파이썬 초보자라고 사람들에게 말하는 것입니다.

8 월 2 일 · 5최소 읽기

며칠 전 Reddit에서 "learnpython"서브를 검색했을 때 Redditor가이 질문을 다시하는 것을 보았습니다. 인터넷상에는이 질문에 대한 답과 설명이 너무 많지만, 많은 초보자들은 여전히 ​​그것에 대해 모르고 실수를합니다. 여기에 질문이 있습니다

"=="와 "is"의 차이점은 무엇입니까?

Image for post
~의 사진Rohit 농부의 위에Unsplash

"=="와 "is"는 모두 Python (Python의 운영자 페이지에 링크). 초보자의 경우 "a == b"를 "a는 b와 같음", "a는 b"로 해석하고 "a는 b"로 해석 할 수 있습니다. 아마도 이것이 초보자들이 파이썬에서 "=="와 "is"를 혼동하는 이유 일 것입니다.

심층 토론을하기 전에 먼저“==”와“is”를 사용하는 몇 가지 예를 보여 드리고자합니다.

>>> a = 5
>>> b = 5
>>> a == b
True
>>> a is b
True

간단 하죠?a == ba는 b둘 다 반환진실. 그런 다음 다음 예제로 이동하십시오.

>>> a = 1000
>>> b = 1000
>>> a == b
True
>>> a is b
False

뭐야?!? 첫 번째 예제에서 두 번째 예제로의 유일한 변경은 a와 b의 값이 5에서 1000까지입니다. 그러나 결과는 이미 "=="와 "is"사이에서 다릅니다. 다음으로 이동하십시오.

>>> a = []
>>> b = []
>>> a == b
True
>>> a is b
False

당신의 마음이 여전히 날아 가지 않은 경우 마지막 예가 있습니다.

>>> a = 1000
>>> b = 1000
>>> a == b
True
>>> a is b
False
>>> a = b
>>> a == b
True
>>> a is b
True

"=="에 대한 공식적인 연산은 평등이고 "is"에 대한 연산은 동일성입니다. 두 개체의 값을 비교하려면 "=="를 사용합니다. "a == b"는 "a의 값이 b의 값과 같은지 여부"로 해석되어야합니다. 위의 모든 예에서 a의 값은 항상 b의 값과 같습니다 (빈 목록 예의 경우에도). 따라서“a == b”는 항상 참입니다.

정체성을 설명하기 전에 먼저신분증함수. 다음을 사용하여 개체의 ID를 얻을 수 있습니다.신분증함수. 이 아이덴티티는 시간 내내이 객체에 대해 고유하고 일정합니다. 이것을이 객체의 주소로 생각할 수 있습니다. 두 개체의 ID가 동일한 경우 해당 값도 동일해야합니다.

>>> id(a)
2047616

연산자 "is"는 두 개체의 ID가 동일한 지 여부를 비교하는 것입니다. “a is b”는“a의 정체는 b의 정체와 같다”는 의미입니다.

"=="및 "is"의 실제 의미를 알고 나면 위의 예를 자세히 살펴볼 수 있습니다.

첫 번째는 첫 번째와 두 번째 예의 다른 결과입니다. 다른 결과를 보여주는 이유는 파이썬이 각 정수에 대해 고정 된 ID로 -5에서 256까지의 정수 배열 목록을 저장하기 때문입니다. 이 범위 내의 정수 변수를 할당하면 Python은이 변수의 ID를 배열 목록 내의 정수에 대한 ID로 할당합니다. 결과적으로 첫 번째 예에서 a와 b의 ID는 모두 배열 목록에서 가져 오므로 해당 ID는 물론 동일하므로a는 b사실이다.

>>> a = 5
>>> id(a)
1450375152
>>> b = 5
>>> id(b)
1450375152

그러나 일단이 변수의 값이이 범위를 벗어나면 내부 파이썬에는 그 값을 가진 객체가 없기 때문에 파이썬은이 변수에 대한 새로운 ID를 만들고이 변수에 값을 할당합니다. 이전에 말했듯이 ID는 각 생성에 대해 고유하므로 두 변수의 값이 동일하더라도 ID는 동일하지 않습니다. 그래서a는 b두 번째 예에서는 False입니다.

>>> a = 1000
>>> id(a)
12728608
>>> b = 1000
>>> id(b)
13620208

(추가 : 두 개의 콘솔을 열면 값이 여전히 범위 내에 있으면 동일한 ID를 얻을 수 있습니다. 그러나 값이 범위를 벗어나는 경우에는 해당되지 않습니다.)

Image for post

첫 번째 예제와 두 번째 예제의 차이점을 이해하면 세 번째 예제의 결과를 쉽게 이해할 수 있습니다. 파이썬은 "빈 목록"객체를 저장하지 않기 때문에 파이썬은 하나의 새 객체를 만들고 "빈 목록"값을 할당합니다. 두 목록이 비어 있거나 동일한 요소가 있어도 결과는 동일합니다.

>>> a = [1,10,100,1000]
>>> b = [1,10,100,1000]
>>> a == b
True
>>> a is b
False
>>> id(a)
12578024
>>> id(b)
12578056

마지막으로 마지막 예제로 이동합니다. 두 번째 예제와 마지막 예제의 유일한 차이점은 코드가 한 줄 더 있다는 것입니다.a = b. 그러나이 코드 줄은 변수의 운명을 변경합니다.. 아래 결과는 그 이유를 알려줍니다.

>>> a = 1000
>>> b = 2000
>>> id(a)
2047616
>>> id(b)
5034992
>>> a = b
>>> id(a)
5034992
>>> id(b)
5034992
>>> a
2000
>>> b
2000

보시다시피a = b, 정체성신원 변경.a = b신원을 할당...에. 그래서 둘 다동일한 정체성을 가지므로지금은 가치와 동일합니다, 즉 2000입니다.

마지막 예는 특히 개체가 목록 인 경우 예고없이 실수로 개체의 값을 변경할 수 있다는 중요한 메시지를 알려줍니다.

>>> a = [1,2,3]
>>> id(a)
5237992
>>> b = a
>>> id(b)
5237992
>>> a.append(4)
>>> a
[1, 2, 3, 4]
>>> b
[1, 2, 3, 4]

위의 예에서, 둘 다동일한 신원을 가지고, 그 값은 동일해야합니다. 따라서 새 요소를 추가 한 후, 의 가치또한 영향을받습니다. 이러한 상황을 방지하기 위해 동일한 ID를 참조하지 않고 한 개체에서 다른 개체로 값을 복사하려는 경우 모든 방법에 대한 방법은 다음을 사용하는 것입니다.딥 카피모듈에서(Python 문서에 링크). 목록의 경우 수행 할 수도 있습니다.b = a [:].

>>> import copy
>>> a = [1,2,3]
>>> b= copy.deepcopy(a)
>>> id(a)
39785256
>>> id(b)
5237992

사용[:]새 변수에 요소 복사

>>> a = [1,2,3]
>>> id(a)
39785256
>>> b = a[:]
>>> id(b)
23850216
>>> a.append(4)
>>> a
[1, 2, 3, 4]
>>> b
[1, 2, 3]

이제 두 사람의 차이점을 이해하고이 질문에 대해 다시는 초보자가되지 않기를 바랍니다.

You are telling people that you are a Python beginner if you ask this question.

Aug 2 · 5 min read

A few days ago when I browsed the “learnpython” sub on Reddit, I saw a Redditor asking this question again. Although there are too many answers and explanations about this question on the Internet, many beginners still do not know about it and make mistakes. Here is the question

What is the difference between “==” and “is”?

Image for post
Photo by Rohit Farmer on Unsplash

Both “==” and “is” are operators in Python(Link to operator page in Python). For beginners, they may interpret “a == b” as “a is equal to b” and “a is b” as, well, “a is b”. Probably this is the reason why beginners confuse “==” and “is” in Python.

I want to show some examples of using “==” and “is” first before the in-depth discussion.

>>> a = 5
>>> b = 5
>>> a == b
True
>>> a is b
True

Simple, right? a == b and a is b both return True. Then go to the next example.

>>> a = 1000
>>> b = 1000
>>> a == b
True
>>> a is b
False

WTF ?!? The only change from the first example to the second is the values of a and b from 5 to 1000. But the results already differ between “==” and “is”. Go to the next one.

>>> a = []
>>> b = []
>>> a == b
True
>>> a is b
False

Here is the last example if your mind is still not blown.

>>> a = 1000
>>> b = 1000
>>> a == b
True
>>> a is b
False
>>> a = b
>>> a == b
True
>>> a is b
True

The official operation for “==” is equality while the operation for “is” is identity. You use “==” for comparing the values of two objects. “a == b” should be interpreted as “The value of a is whether equal to the value of b”. In all examples above, the value of a is always equal to the value of b (even for the empty list example). Therefore “a == b” is always true.

Before explaining identity, I need to first introduce id function. You can get the identity of an object with idfunction. This identity is unique and constant for this object throughout the time. You can think of this as an address for this object. If two objects have the same identity, their values must be also the same.

>>> id(a)
2047616

The operator “is” is to compare whether the identities of two objects are the same. “a is b” means “The identity of a is the same as the identity of b”.

Once you know the actual meanings of “==” and “is”, we can start going deep on those examples above.

First is the different results in the first and second examples. The reason for showing different results is that Python stores an array list of integers from -5 to 256 with a fixed identity for each integer. When you assign a variable of an integer within this range, Python will assign the identity of this variable as the one for the integer inside the array list. As a result, for the first example, since the identities of a and b are both obtained from the array list, their identities are of course the same and therefore a is bis True.

>>> a = 5
>>> id(a)
1450375152
>>> b = 5
>>> id(b)
1450375152

But once the value of this variable falls outside this range, since Python inside does not have an object with that value, therefore Python will create a new identity for this variable and assign the value to this variable. As said before, the identity is unique for each creation, therefore even the values of two variables are the same, their identities are never equal. That’s why a is bin the second example is False

>>> a = 1000
>>> id(a)
12728608
>>> b = 1000
>>> id(b)
13620208

(Extra: if you open two consoles, you will get the same identity if the value is still within the range. But of course, this is not the case if the value falls outside the range.)

Image for post

Once you understand the difference between the first and second examples, it is easy to understand the result for the third example. Because Python does not store the “empty list” object, so Python creates one new object and assign the value “empty list”. The result will be the same no matter the two lists are empty or with identical elements.

>>> a = [1,10,100,1000]
>>> b = [1,10,100,1000]
>>> a == b
True
>>> a is b
False
>>> id(a)
12578024
>>> id(b)
12578056

Finally, we move on to the last example. The only difference between the second and the last example is that there is one more line of code a = b.However this line of code changes the destiny of the variable a. The below result tells you why.

>>> a = 1000
>>> b = 2000
>>> id(a)
2047616
>>> id(b)
5034992
>>> a = b
>>> id(a)
5034992
>>> id(b)
5034992
>>> a
2000
>>> b
2000

As you can see, after a = b, the identity of a changes to the identity of b. a = bassigns the identity of bto a. So both aand b have the same identity, and thus the value of a now is the same as the value of b, which is 2000.

The last example tells you an important message that you may accidentally change the value of an object without notice, especially when the object is a list.

>>> a = [1,2,3]
>>> id(a)
5237992
>>> b = a
>>> id(b)
5237992
>>> a.append(4)
>>> a
[1, 2, 3, 4]
>>> b
[1, 2, 3, 4]

From the above example, because both a and bhave the same identity, their values must be the same. And thus after appending a new element to a, the value of bwill be also impacted. To prevent this situation, if you want to copy the value from one object to another object without referring to the same identity, the one for all method is to use deepcopyin the module copy (Link to Python document). For list, you can also perform by b = a[:] .

>>> import copy
>>> a = [1,2,3]
>>> b= copy.deepcopy(a)
>>> id(a)
39785256
>>> id(b)
5237992

Using [:]for copying elements to a new variable

>>> a = [1,2,3]
>>> id(a)
39785256
>>> b = a[:]
>>> id(b)
23850216
>>> a.append(4)
>>> a
[1, 2, 3, 4]
>>> b
[1, 2, 3]

I hope now you can understand the difference between the two and you will not be a beginner again for asking this question.

Rank Game Publisher
1 리니지M NCSOFT
2 리니지2M NCSOFT
3 KartRider Rush+ NEXON Company
4 바람의나라: 연 NEXON Company
5 Genshin Impact miHoYo Limited
6 V4 NEXON Company
7 기적의 검 4399 KOREA
8 R2M Webzen Inc.
9 뮤 아크엔젤 Webzen Inc.
10 라이즈 오브 킹덤즈 LilithGames
11 블레이드&소울 레볼루션 Netmarble
12 A3: 스틸얼라이브 Netmarble
13 AFK 아레나 LilithGames
14 Pmang Poker : Casino Royal NEOWIZ corp
15 가디언 테일즈 Kakao Games Corp.
16 그랑삼국 YOUZU(SINGAPORE)PTE.LTD.
17 일루전 커넥트 ChangYou
18 슬램덩크 DeNA HONG KONG LIMITED
19 라그나로크 오리진 GRAVITY Co., Ltd.
20 리니지2 레볼루션 Netmarble
21 FIFA ONLINE 4 M by EA SPORTS™ NEXON Company
22 컴투스프로야구2020 Com2uS
23 Summoners War Com2uS
24 PUBG MOBILE PUBG CORPORATION
25 스테리테일 4399 KOREA
26 Roblox Roblox Corporation
27 한게임 포커 NHN BIGFOOT
28 랑그릿사 ZlongGames
29 FIFA Mobile NEXON Company
30 검은사막 모바일 PEARL ABYSS
31 마구마구 2020 Netmarble
32 Brawl Stars Supercell
33 메이플스토리M NEXON Company
34 Epic Seven Smilegate Megaport
35 Gardenscapes Playrix
36 Cookie Run: OvenBreak - Endless Running Platformer Devsisters Corporation
37 동방불패 모바일 Perfect World Korea
38 케페우스M Ujoy Games
39 Age of Z Origins Camel Games Limited
40 프린세스 커넥트! Re:Dive Kakao Games Corp.
41 뮤오리진2 Webzen Inc.
42 Empires & Puzzles: Epic Match 3 Small Giant Games
43 Lord of Heroes CloverGames
44 황제라 칭하라 Clicktouch Co., Ltd.
45 Rise of Empires: Ice and Fire Long Tech Network Limited
46 리니지M(12) NCSOFT
47 명일방주 Yostar Limited.
48 Random Dice: PvP Defense 111%
49 Clash of Clans Supercell
50 Homescapes Playrix

Scikit-Learn (Python) : 데이터 과학자를위한 6 가지 유용한 트릭

scikit-learn (sklearn)을 사용하여 Python에서 기계 학습 모델을 개선하는 방법

Image for post

Scikit-learn (sklearn)강력한 오픈 소스입니다기계 학습 라이브러리Python 프로그래밍 언어 위에 구축되었습니다. 이 라이브러리에는 다양한 분류, 회귀 및 클러스터링 알고리즘을 포함하여 기계 학습 및 통계 모델링을위한 많은 효율적인 도구가 포함되어 있습니다.

이 기사에서는 scikit-learn 라이브러리와 관련된 6 가지 트릭을 보여 주어 특정 프로그래밍 방식을 좀 더 쉽게 할 수 있습니다.

1. 임의 더미 데이터 생성

임의의 '더미'데이터를 생성하기 위해의 경우 기능분류 데이터, 및의 경우 기능회귀 데이터. 이것은 디버깅 할 때나 (작은) 임의의 데이터 세트에서 특정 작업을 시도하려는 경우에 매우 유용합니다.

아래에서는 4 개의 특성 (X에 있음)과 클래스 레이블 (y에 있음)로 구성된 10 개의 분류 데이터 포인트를 생성합니다. 여기서 데이터 포인트는 네거티브 클래스 (0) 또는 포지티브 클래스 (1)에 속합니다.

여기에서 X는 생성 된 데이터 포인트에 대한 4 개의 특성 열로 구성됩니다.

Image for post

그리고 y에는 각 데이터 요소의 해당 레이블이 포함됩니다.

2. 결 측값 대치

Scikit-learn은돌리다누락 된 값. 여기에서는 두 가지 접근 방식을 고려합니다. 그만큼클래스는 결 측값을 대치하기위한 기본 전략을 제공합니다 (예 : 평균 또는 중앙값을 통해). 보다 정교한 접근 방식클래스는 다음을 사용하여 결 측값을 채우기위한 대치를 제공합니다.K- 최근 접 이웃접근하다. 각 누락 된 값은특정 기능에 대한 값이있는 최근 접 이웃. 이웃 값은 균일하게 평균화되거나 각 이웃까지의 거리에 따라 가중치가 부여됩니다.

아래에서는 두 대치 방법을 사용하는 예제 응용 프로그램을 보여줍니다.

>>> 2.21298305

X [1, 2]를 누락 된 값으로 변환합니다.

Image for post

먼저 우리는단순 전가:

Image for post

결과 값-0.143476.

다음으로 우리는KNN 입력, 2 개의 가장 가까운 이웃이 고려되고 이웃에 균일 한 가중치가 부여됩니다.

Image for post

결과 값0.997105(= 0.5 * (1.904188 + 0.090022)).

3. 파이프 라인을 사용하여 여러 단계를 함께 연결

그만큼관로scikit-learn의 도구는 기계 학습 모델을 단순화하는 데 매우 유용합니다. 파이프 라인을 사용하여 여러 단계를 하나로 연결하여 데이터가 고정 된 일련의 단계를 거치도록 할 수 있습니다. 따라서 모든 단계를 개별적으로 호출하는 대신 파이프 라인은 모든 단계를 하나의 시스템으로 연결합니다. 이러한 파이프 라인을 생성하기 위해 우리는함수.

아래에는 파이프 라인이 누락 된 값 (있는 경우)을 대치하는 대치 자와 로지스틱 회귀 분류기로 구성된 간단한 예가 나와 있습니다.

이제 파이프 라인을 사용하여 훈련 데이터를 맞추고 테스트 데이터를 예측할 수 있습니다. 먼저 훈련 데이터가 대치되어 로지스틱 회귀 분류기를 사용하여 훈련을 시작합니다. 그런 다음 테스트 데이터의 클래스를 예측할 수 있습니다.

4. joblib를 사용하여 파이프 라인 모델 저장

scikit-learn을 통해 생성 된 파이프 라인 모델은 다음을 사용하여 쉽게 저장할 수 있습니다.joblib. 모델에 큰 데이터 배열이 포함 된 경우 각 배열은 별도의 파일에 저장됩니다. 로컬에 저장되면 새 응용 프로그램에서 사용할 모델을 쉽게로드 (또는 복원) 할 수 있습니다.

이제 피팅 된 파이프 라인 모델은 다음을 통해 컴퓨터에 저장 (덤프)됩니다.. 이 모델은, 그리고 나중에 평소와 같이 적용 할 수 있습니다.

5. 혼동 행렬 플로팅

혼동 행렬테스트 데이터 세트에 대한 분류기의 성능을 설명하는 데 사용되는 테이블입니다. 여기서 우리는이진 분류 문제즉, 관측 값이 속할 수있는 두 가지 가능한 클래스가 있습니다. "예"(1) 및 "아니요"(0).

예제 이진 분류 문제를 만들고 다음을 사용하여 해당 정오 행렬을 표시해 보겠습니다.함수:

Image for post

여기에있는 혼동 행렬을 통해 멋진 방식으로 시각화했습니다.

  • 93참 양성 (TP);
  • 97참 음성 (TN);
  • 거짓 양성 (FP);
  • 7거짓 음성 (FN).

따라서 우리는 (93 + 97) / 200 = 95 %의 정확도 점수에 도달했습니다.

6. 의사 결정 트리 시각화

가장 잘 알려진 분류 알고리즘 중 하나는의사 결정 트리, 특징 매우 직관적 인 나무 모양의 시각화. 의사 결정 트리의 아이디어는 설명 기능을 기반으로 데이터를 더 작은 영역으로 분할하는 것입니다. 그런 다음 테스트 관찰이 속한 지역에서 훈련 관찰 중 가장 일반적으로 발생하는 클래스는 예측입니다. 데이터가 지역으로 분할되는 방법을 결정하려면 다음을 적용해야합니다.분할 측정각 기능의 관련성과 중요성을 결정합니다. 잘 알려진 분할 측정으로는 정보 이득, 지니 지수 및 교차 엔트로피가 있습니다.

아래에서는 사용 방법에 대한 예를 보여줍니다.scikit-learn의 기능 :

Image for post

이 예에서는 네거티브 클래스 (0) 또는 포지티브 클래스 (1)에 속하는 40 개의 훈련 관찰에 대한 의사 결정 트리를 피팅하고 있습니다.이진 분류 문제. 트리에는 두 가지 종류의 노드가 있습니다.내부 노드(예측 자 공간이 더 분할 된 노드) 또는터미널 노드(종료점). 두 노드를 연결하는 트리의 세그먼트를가지.

의사 결정 트리의 각 노드에 대해 제공되는 정보를 자세히 살펴 보겠습니다.

  • 그만큼분할 기준 used in the particular node is shown as e.g. ‘F2 <= -0.052’. This means that every data point that satisfies the condition that the value of the second feature is below -0.052 belongs to the newly formed region to the left, and the data points that do not satisfy the condition belong to the region to the right of the internal node.
  • 그만큼지니 지수여기서 분할 측정으로 사용됩니다. 지니 지수 (불결)는 특정 요소가 무작위로 선택되었을 때 잘못 분류되는 정도 또는 확률을 측정합니다.
  • 노드의 '샘플'은 특정 노드에서 발견 된 훈련 관찰의 수를 나타냅니다.
  • 노드의 '값'은 각각 네거티브 클래스 (0)와 포지티브 클래스 (1)에서 찾은 훈련 관찰의 수를 나타냅니다. 따라서 value = [19,21]은 19 개의 관측치가 네거티브 클래스에 속하고 21 개의 관측치가 해당 특정 노드의 포지티브 클래스에 속함을 의미합니다.

결론

이 기사에서는 sklearn에서 기계 학습 모델을 개선하기위한 6 가지 유용한 scikit-learn 트릭을 다뤘습니다. 이 트릭이 어떤 식 으로든 도움이 되었기를 바랍니다. scikit-learn 라이브러리를 사용할 때 다음 프로젝트에서 행운을 빕니다!

+ Recent posts