Python

Google Colab: 3 Ways To Save Pandas Dataframe Data

This post will demo 3 Ways to save pandas data. - download as a csv file. - save as a csv file to Google drive. - save as a Google spreadsheet to Google drive.

Python

Google Colab introduction & Tips

In this article, I want to introduce a powerful service, 'Google collaboratory'(or 'Google Colab' for short). And some useful tips to use it.

Python

Python: Use urllib.request to do http request

In this article, I will show you how to execute HTTP requests with urllib.request. The workflow is, 1. Create a request by `urllib.request.Request` method. 2. Assign the request as a parameter of `urllib.request.urlopen` method to get response. 3. use `json` module to parse the response.

Python

Python: use pyenv to manage the version of Python

Here will show you about pyenv installation and usage. - Use **Homebrew** to install **pyenv**. - Use pyenv install --list to check the list. - Use pyenv versions to check if the specific version of python is installed or not. - Use pyenv global <version> or pyenv local <version> to switch version of python.

Python

Python project: files in folders are organized by file type

Here are 4 points are used to reorganized files in folder by file type. 1. use `os.path.isdir()` function to check if the folder exists or not. 2. use `os.listdir()` function to get the file list in the folder. 3. use `os.path.splitext()` funciton to get file's extension. 4. use `shutil.copyfile()` to copy the file to target path.

Python

Python: 4 ways to create Pandas DataFrame

The **DataFrame** of **pandas** is a very common object used in doing data analysis. This article introduces four common ways (**NumPy**, **dist**, **list**, **csv file**) to build a DataFrame.