pandas is a dependency hell... it imports everything under heaven and hell whether you require it in your program or not
run pyinstaller first time with this this flag
--onedir
pyinstaller --onedir --hidden-import pandas --hidden-import os --exclude * main.py
..go to "dist" directory
and in the generated dist "directory" you will see directories for each imported module. delete one by one..and see if your program executes till you have tried deleted all modules which are not required for your program to run
keep a note of those directories (modules) without which your program runs fine
and re run pyinstaller
like in this example
pyinstaller --hidden-import pandas --hidden-import os --exclude-module
"matplotlib" --exclude-module "PIL" --exclude-module "IPython"
--exclude-module "ipykernel" --exclude-module "qtpy"
--exclude-module "nbformat" --exclude-module "scipy"
--exclude-module "sklearn" --exclude * main.py
alternatvely make a spec file by running
pyi-makespec main.py
Edit the genrated spec file to exclude/include modules you need
and then run pyinstaller using that spec file
pyinstaller main.spec