Another article about the DataFrame type where the focus is to display the available column of a DataFrame. Actually, DataFrame is a data structure that come with Pandas library for manipulating data. After successfully retrieve data and store it into a varilable with the type of Dataframe, it is possible to check the available column of it. The process will be available by running a script in a certain program. The program is the ‘jupyter notebook’. On the other hand, according to this link, The Jupyter Notebook is an open-source web application that allows to create and share documents that contain live code, equations, visualizations and narrative text. That includes data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.
So, execute the jupyter notebook as in the following execution :
(myenv) C:\python\data-science>jupyter notebook [I 17:08:28.062 NotebookApp] Serving notebooks from local directory: C:\python\data-science [I 17:08:28.062 NotebookApp] The Jupyter Notebook is running at: [I 17:08:28.067 NotebookApp] http://localhost:8888/?token=4dd9801ef2aacad1d445955b0ae4621b4c669da84c617e7b [I 17:08:28.068 NotebookApp] or http://127.0.0.1:8888/?token=4dd9801ef2aacad1d445955b0ae4621b4c669da84c617e7b [I 17:08:28.070 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 17:08:28.225 NotebookApp] To access the notebook, open this file in a browser: file:///C:/Users/Personal/AppData/Roaming/jupyter/runtime/nbserver-8796-open.html Or copy and paste one of these URLs: http://localhost:8888/?token=4dd9801ef2aacad1d445955b0ae4621b4c669da84c617e7b or http://127.0.0.1:8888/?token=4dd9801ef2aacad1d445955b0ae4621b4c669da84c617e7b
Continue on to load the data into a DataFrame. This article uses an example from another article How to Get Data From a PostgreSQL Database in Jupyter Notebook . After successfully retrieve the data, execute the following script to see the available column in the DataFrame variable :
Where in the above pattern, df is a DataFrame variable and dtypes is the attribute of it. The following is an example of the above script pattern :
Another function available in the DataFrame for displayin the column information is by using the ‘info()’ function. The pattern for using that function exist as follows :
Where df is actually a DataFrame variable with info() as its function. Below is the example of the command execution :