2021/08 9

Python - cmd 명령어 결과 DataFrame 변환

import os import pandas as pd def get_dataframe_text(f) : header = None # df_task_info = pd.DataFrame(columns = ['processid', 'parentprocessid', 'commandline']) flag = True while True : #1. text 데이터 확인 line = f.readline() if not line : break #2. text -> list 변환하여 길이 확인 line = line.split() line_list = list(line) if len(line_list) == 0 : continue if flag == True : flag = False header = pd.Series(l..

윈도우 명령어(cmd.exe)

1. 프로세스 목록 조회 - tasklist.exe /fi "imagename eq py*" - tasklist.exe /v /fi "imagename eq py*" 2. WMIC 명렁어 wmic path Win32_PerfFormattedData_PerfProc_Process 명령어 --> CPU 부하 확인 wmic path Win32_PerfFormattedData_PerfProc_Process where "name like 'py%'" get Name, IDProcess, PercentProcessorTime process 실행 정보 가져오기 wmic process where "name like 'py%'" get processid, parentprocessid, commandline 3. Win3..

#1-3 Windows Tip 2021.08.31

문자열 계산식 구현 - 후위표기법#1

1. 목적 - 문자열 계산식을 순서대로 계산할 경우 우선 순위에 따른 계산 오류 발생 ex) (1+2) * (3+4) / 4 --> 아래 같이 계산 순서 필요 2. 계산식 표현법 1) 중위 표현법 - 연산자가 피연사자들 사이에 위치 2) 후위 표현법 - 연산자가 피연사자들 뒤에 위치 (사칙연산 프로그램을만들때 편리하게 설계) 설계 방법) 1) 피연산자(숫자)는 스택에 넣지 않고 그냥 출력 2) 연산자의 경우 -> Stack이 비어 있으면 Stack에 저장 -> Stack에 연산자가 있는 경우 ->연산자(Stack)의 우선순위가 같거나 크면 pop하여 출력하고 현재 연산자를 Stack에 저장 ->연산자(Stack)의 우선순위가 낮을 경우 현재 연산자를 Stack에 저장 3) 수식이 끝나면 스택이 빌 때 까..

1_Pandas 생성

1. Pandas 설치 - pip install pandas 2. Pandas 참조 - import padnas as pd 3. Pandas 데이터타입 - Series : 컬럼이 한 개 있는 형태 - Data Frame : 컬럼이 두 개 이상인 형태 예제1) Series 사용 import pandas as pd #Series -> 컬럼이 한 개만 형태 #DataFrame -> 컬럼이 두 개 이상인 형태 member = pd.Series(['kim', 'lee', 'park']) print(member) 결과 --> 예제2) #dictionary -> Series 변경 dic_member2 = {'홍길동' : 100, '일지매' : 200, '전우치' : 300} dic_member3= {'홍길동' : 1..

카테고리 없음 2021.08.18