• Kaggle_Data Visulazation of seaborn


    exercise1

    首先下载.csv文件的数据集,该数据集是基于如下背景:

    In this notebook, we'll work with a dataset of historical FIFA rankings for six countries: Argentina (ARG), Brazil (BRA), Spain (ESP), France (FRA), Germany (GER), and Italy (ITA). The dataset is stored as a CSV file (short for comma-separated values file. Opening the CSV file in Excel shows a row for each date, along with a column for each country.

    step1头文件导入

    import pandas as pd
    pd.plotting.register_matplotlib_converters()
    import matplotlib.pyplot as plt
    %matplotlib inline
    import seaborn as sns
    
    # Set up code checking
    import os
    if not os.path.exists("../input/fifa.csv"):
        os.symlink("../input/data-for-datavis/fifa.csv", "../input/fifa.csv")  
    from learntools.core import binder
    binder.bind(globals())
    from learntools.data_viz_to_coder.ex1 import *
    print("Setup Complete")

    验证数字正确性

    # Fill in the line below
    one = 1
    
    # Check your answer
    step_1.check()

    step2载入数据集

    # Path of the file to read
    fifa_filepath = "../input/fifa.csv"
    
    # Read the file into a variable fifa_data
    fifa_data = pd.read_csv(fifa_filepath, index_col="Date", parse_dates=True)
    
    # Check your answer
    step_2.check()

    其中无数次地检测 hint() and solution()

    step3 画数据图

    # Set the width and height of the figure
    plt.figure(figsize=(16,6))
    
    # Line chart showing how FIFA rankings evolved over time
    sns.lineplot(data=fifa_data)
    
    # Check your answer
    step_3.a.check()

    get the result

    kaggle上的例子,在博客均用于练习和后期为Data science做准备,请大家不要商业化。

  • 相关阅读:
    Electron+Vue开发跨平台桌面应用
    vue-cli3.0 脚手架搭建项目的过程详解
    dart-sass与node-sass介绍
    创建vue-cli4项目,报错 ERROR command failed: yarn
    CSS Grid 网格布局教程
    总结5种自适应方式
    前端实战:electron+vue3+ts开发桌面端便签应用
    SDK 和 API 的区别是什么?
    Pinia 快速入门
    返回数组中最大的三个数
  • 原文地址:https://www.cnblogs.com/yuyukun/p/12864795.html
Copyright © 2020-2023  润新知