First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
0

while using python code in psse, psse is not able to recognize other libraries like "xlsxwriter"

asked Feb 2 '4

fawadian gravatar image

I am running a python code in psse which gets data from psse and does some working on it and writes the data to an excel file. The library is xlsxwriter. Even though i have installed this library using pip. Still its does not recognize this library.

1 answer

Sort by » oldest newest most voted
0

answered Feb 2 '4

jconto gravatar image

Check if errors were printed during installation. Check list of modules installed in CMD window with "pip list"

Test import command in python, in CMD window:

c:\..>python
>>import xlsxwriter

No error messages if able to import.

Test a simple code (works in python 3.9):

import xlsxwriter

workbook = xlsxwriter.Workbook('arrays.xlsx')
worksheet = workbook.add_worksheet('test')

array = [['a1', 'a2', 'a3'],
         ['a4', 'a5', 'a6'],
         ['a7', 'a8', 'a9'],
         ['a10', 'a11', 'a12', 'a13', 'a14']]

row = 0

for col, data in enumerate(array):
    worksheet.write_column(row, col, data)

workbook.close()
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

Stats

Asked: Feb 2 '4

Seen: 117 times

Last updated: Feb 02 '24