Skip to content

Authentication, updated data, formatting#2

Open
s-feinstein wants to merge 2 commits intosaeid-uot:mainfrom
s-feinstein:week_1_2022_updates
Open

Authentication, updated data, formatting#2
s-feinstein wants to merge 2 commits intosaeid-uot:mainfrom
s-feinstein:week_1_2022_updates

Conversation

@s-feinstein
Copy link

I was receiving an error when running the first snippet of code to authenticate.

Based on https://stackoverflow.com/a/71711274 I updated the notebook and found it worked for me.

Additionally updated BLI file to current.

Oddly, it insists I have the '.xlsx' extension specified on the BLI file or it fails, but insists I leave the '.xlsx' extension off the WEO_Data file or it fails. User error?

I was receiving an error when running the code below.
Based on https://stackoverflow.com/a/71711274 I updated the notebook and found it worked for me.
I found that if I updated column F to 0.00 format as instructed, it also updated the header. Obviously it should be 2015, not 2,015.00 but if we're changing the name of the column anyway we might as well apply the format to the entirety of column F and avoid this little "gotcha".
@s-feinstein
Copy link
Author

s-feinstein commented Sep 26, 2022

In addition to a normally thorough review, I'd like to call particular attention to this oddity:

Oddly, it insists I have the '.xlsx' extension specified on the BLI file or it fails, but insists I leave the '.xlsx' extension off the WEO_Data file or it fails. User error?

As an aside, the file comparison is quite well formatted when viewed in github.dev and other tools, but quite a mess when viewed online.

@saeid-uot
Copy link
Owner

Hi David,

Since the file format is not Git friendly (Ipynb), are you able to share the before and after screenshot of the changes in the code? The old code still runs on my side and I think changes that you made (if I am not mistaken) throws error.

####Saeid Comment: Below snippet throws an error on authentication. It this the code you added?

Run below line of code for the first time to install gspread. Once installed comment it for future use

#!pip install --upgrade -q gspread
from google.colab import auth
auth.authenticate_user()

import gspread
from oauth2client.client import GoogleCredentials

gc = gspread.authorize(GoogleCredentials.get_application_default())

####Saeid COmments: below code runs without an error; it simply downloads the file from GDrive. If you. get an error on below code, it might be because of access management on the file itself; it is not the code.

#get file from google drive
%%time
!pip install googledrivedownloader #black magic
from google_drive_downloader import GoogleDriveDownloader as gdd

gdd.download_file_from_google_drive(file_id="1AavEtw38uMBhcDLmejYU_L8LVbbrWtlh",
dest_path="./BLI_30012019054825599.xlsx",
unzip=False)

gdd.download_file_from_google_drive(file_id="1Z0hri7DaH37aH-VGmyC5G2Uo240NfFms",
dest_path="./WEO_Data.xlsx",
unzip=False)

Please let me know and I will be happy to review/merge.

Thanks
Saeid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants