Import a .mdb file into Python - python-2.7

I want to import a .mdb file into Python (I'm using Jupyter). My file name is PIF.mdb and i want a table called ValuesXYZ. Do anyone know what code works for this? I teste a lot of codes but they doesn't worked.
So grateful,
Henrique.

Unfortunately, you cannot directly read the table.
.mdb is database file and not tables. You need to connect to it first, via pyodbc for example.
This SO thread explains it really well.

Related

Is there a way to use SQLite commands in the C++ interface for SQLite?

I am trying to import a CSV file into a SQLite Database through C++ code. Normally through the SQLite command line I would go
sqlite3 db
.import statistics.csv stats
I am wondering how to do this exact same thing through the C++ Interface for SQLite.
There is no public SQLite C++ API to do what import does exactly. You need to read the CSV file yourself and insert the values as normal.

How to resolve the issue of file not found (even though it exists) on GCP's AI-Platform?

FileNotFoundError: File b'gs://text-recognition-modelling/Dhruv/cmle/eval_data_nott03.csv' does not exist
Problem seems like you are using pandas for reading the csv, try using some tensorflow method to read csv, it would work.

Cannot export Pandas dataframe to specified file path in Python for csv and excel both

I have written a program which exports my Pandas DataFrame to a csv as well as an excel file. However, the problem I am facing is that, randomly, the export function to both the file formats does not work, resulting in me seeing an error stating "No such File Path or Directory".
My code is as follows:
frame3.to_csv('C:/Users/Downloads/ABC_test.csv',index=False)
writer = pd.ExcelWriter('C:/Users/Downloads/ABCD.xlsx', engine='openpyxl')
frame3.to_excel(writer, sheet_name='Sheet1')
writer.save()
The major issue is that this code works sometimes and sometimes it does not! Going by what others have posted here, I tried to add the output directory by the use of
pth1 = os.path.join(r'C:/Users/Downloads/FinalProgram/', output_filename)
frame3.to_csv(pth1)
Sadly, this has no effect on this stubborn error. Would appreciate any help / insights possible on the matter.
Forgot to update - I figured a way around this particular problem:
Simply set the working directory for the program to be the output directory (as depicted by the command below), before the calling the 'to_csv' function.
os.chdir('F:/Codelah/')
On a side note, this was an issue I primarily faced on Windows OS - Ubuntu worked like a charm and did not require this workaround!
Hope this helps

Copy files from local PC to SAS server in Enterprise Guide

I need to extract a particular sheet from a .xls file on my local machine and get it as a .sas7bdat files on the SAS server on which I work (or the other way round, that is, import it and then convert).
The problem is that although this can be done using the Import Wizard, I need to do this using the 'Copy Files Add-in' because it needs to be built as a part of an automated process.
When I tried doing this using the copy files add-in, it DID copy the .xls file onto the server according to the log, but the .xls file didn't actually show in the library and could not be referenced either (or maybe I'm just referencing it wrongly).
This has led me to believe that I need to convert it to a .sas7bdat and then import it.
Is there a way to get past this? Please bear in mind that I am talking about an automated process, so the wizard is useless for me (or is it? I'm not sure)
NOTE : I am extremely sorry that I cannot post the log and screenshots here, because I work as an offshore resource for a very large bank and cannot post anything here. I have, however, tried to make my problem as clear as possible. If any further clarifications are needed, please let me know!
I assume you've read There and Back Again which covers this in some detail.
Ultimately, all you're doing is copying the excel file as a file onto the SAS server. You're not importing it into a SAS dataset. You would import it by placing the file (either the remote file after copy files add-in, or the local file) in the workflow as an import step.
For example, if you chose /usr/lib/sasdata/myexcel.xls as the remote copy destination, you then need to include that file in your workflow as an import step (you can drag/drop the file and it will automatically create that step for you, with some wizardry).

schema in Django with sqlite

I am new to Django, i was going through this Django site for building up a basic app.
They have explained the procedure's to use either SQLITE3 , MYSQL, postgresql... I used SQLITE3 as they tell about it being a single large file which makes it easy to use initially.
The problem i am facing is to use .schema to check the database created. I checked certain sites which tell about using it. But i am getting stuck and i m confused to use it.
What i did was
$sqlite3
sqlite>.schema
sqlite>
This above code didnt work, then i came across a forum where they told to install a add_on to Mozilla fox, which didnt work to me as there was a compatibility issue. I even specified the path name where i have this database file located.
$sqlite3
sqlite> /home/ntan3/Django-1.2.3/mysite/eg_sqlite.db
which gave an error saying wrong syntax near '/' .
The thing is could successfully run
the sample application explained by
the Django site.
but i wanted to see the Database created. Please Help
could anyone guide me a proper way to do it? even a specific link is also helpful.
Thank you.
This is basic command-line stuff. You need to pass in the path to the db file when you type sqlite3:
$ sqlite3 /home/ntan3/Django-1.2.3/mysite/eg_sqlite.db