pandas 와 openpyxl을 사용 하여
data 값을 핸들링 한 후 엑셀로 바로 저장 하고 싶습니다.
그런데 엑셀로 저장을 하는 부분이 있으면 에러가 납니다.
import pandas as pd
def executionDF():
s1 = pd.core.series.Series([1, 2, 3, 4, 5])
s2 = pd.core.series.Series([“one”, “two”, “three”, “four”, “five”, “six”, “seven”])
df = pd.DataFrame(data=dict(num=s1, word=s2, a=“”))
df.to_excel(“pandas_to_excel.xlsx”, sheet_name=“new_sheet_name”) # 이 줄이 문제
print(“hello world!”)
return df.to_json(orient=“records”)
라는 파일을 작성 실행 하면,
df.to_excel("pandas_to_excel.xlsx", sheet_name="new_sheet_name") # 이 줄이 문제
라인을 활성화 시키면 에러가 뜹니다.
추가질문 : 에러의 상세 코드를 볼 수 없을까요?
Invoke Python Method: One or more errors occurred.
라고만 뜨니깐 답답합니다.
파이썬 코드의 들여쓰기가 잘 되지 않네요. 감안하고 봐주시면 감사하겠습니다.