Book Image

Python Data Science Essentials - Third Edition

By : Alberto Boschetti, Luca Massaron
Book Image

Python Data Science Essentials - Third Edition

By: Alberto Boschetti, Luca Massaron

Overview of this book

Fully expanded and upgraded, the latest edition of Python Data Science Essentials will help you succeed in data science operations using the most common Python libraries. This book offers up-to-date insight into the core of Python, including the latest versions of the Jupyter Notebook, NumPy, pandas, and scikit-learn. The book covers detailed examples and large hybrid datasets to help you grasp essential statistical techniques for data collection, data munging and analysis, visualization, and reporting activities. You will also gain an understanding of advanced data science topics such as machine learning algorithms, distributed computing, tuning predictive models, and natural language processing. Furthermore, You’ll also be introduced to deep learning and gradient boosting solutions such as XGBoost, LightGBM, and CatBoost. By the end of the book, you will have gained a complete overview of the principal machine learning algorithms, graph analysis techniques, and all the visualization and deployment instruments that make it easier to present your results to an audience of both data science experts and business users
Table of Contents (11 chapters)

Graph loading, dumping, and sampling

Beyond NetworkX, graphs and networks can be generated and analyzed with other software. One of the best open source multiplatform software that can be used for their analysis is named Gephi. It's a visual tool and it doesn't require programming skills. It's freely available at http://gephi.github.io.

As in machine learning datasets, even graphs have standard formats for storing, loading, and exchanging. This way, you can create a graph with NetworkX, dump it to a file, and then load and analyze it with Gephi.

One of the most frequently used formats is Graph Modeling Language (GML). Now, let's see how we can dump a graph into a GML file:

In: dump_file_base = "dumped_graph"

# Be sure the dump_file file doesn't exist
def remove_file(filename):
import os
if os.path.exists(filename):
...