Hi.
I try write code to export data base to Excel file.
Ageing I have a problem with modules.
I try find how install that and still don’t works.
Please help, thanks.
beginning of code
import pandas as pd
import openpyxl
welcome
print(“That is simple data base.”)
print(“Please input date.”)
print(‘\n’)
input data
username = input("Name: ")
usersurename = input("Surename: ")
age = input("Enter age: ")
height = input("Enter height: ")
yob = input("Enter YoB: ")
open file
f = open(“data_base.txt”, “a”)
write date to file
f.write(‘\n’)
f.write("Name: ")
f.write(username)
f.write(‘\n’)
f.write("Surename: ")
f.write(usersurename)
f.write(‘\n’)
f.write("Age: ")
f.write(age)
f.write(‘\n’)
f.write("height: ")
f.write(height)
f.write(‘\n’)
f.write("yob: ")
f.write(yob)
f.write(‘\n’)
f.write(‘\n’)
close file
f.close()
open file data base and print data
f = open(“data_base.txt”, “r”)
print(f.read())
export to excel
df = pd.DataFrame([[username, usersurename, age, height, yob], [12, 22, 32], [31, 32, 33]],
index=[‘Name’, ‘Surnename’, ‘Age’, ‘height’, ‘yob’], columns=[‘a’, ‘b’, ‘c’])
print(df)
end export to excel
end of code
Python 3.11.0rc1 (main, Aug 12 2022, 10:02:14) [GCC 11.2.0] on linux
Type “help”, “copyright”, “credits” or “license()” for more information.
======== RESTART: /home/piotr/python/data_base/02_data_base_export_to_excel.py ========
Traceback (most recent call last):
File “/usr/lib/python3.11/idlelib/run.py”, line 578, in runcode
exec(code, self.locals)
File “/home/piotr/python/data_base/02_data_base_export_to_excel.py”, line 3, in
import pandas as pd
File “/usr/lib/python3/dist-packages/pandas/init.py”, line 22, in
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
- The Python version is: Python3.11 from “/usr/bin/python3.11”
- The NumPy version is: “1.21.5”
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named ‘numpy.core._multiarray_umath’