コード例 #1
0
from FileLoader import FileLoader
from YoungestFellah import youngestFellah

fl = FileLoader()
df = fl.load("../resources/athlete_events.csv")
print(youngestFellah(df, 2004))
コード例 #2
0
from FileLoader import FileLoader as loader
from YoungestFellah import youngestFellah


data = loader.load('../data/athlete_events.csv')
print(youngestFellah(data, 2004))
コード例 #3
0
import pandas as pd
from YoungestFellah import youngestFellah
from FileLoader2 import FileLoader2

fl2 = FileLoader2()
path3 = r"C:\Users\Gabriel\Desktop\Mes documents - Google Drive\DATA\19\day04\athlete_events.csv"
df = fl2.load(path3)

youngestFellah(path3, 1994)
コード例 #4
0

class FileLoader:
    def load(
        path
    ):  #The argument of this method is the file path of the dataset to load. It must display a message specifying the dimensions of the dataset (e.g. 340 x 500). The method returns the dataset loaded as a pandas.DataFrame.
        i = len(path) - 1
        while path[i] != '.':
            i -= 1
        extension = path[i:len(path)]
        if extension == ".txt":
            file = pd.read_txt(path)
        if extension == ".csv":
            file = pd.read_csv(path)
        print("Loading dataset of dimensions %d x %d" %
              (file.shape[0], file.shape[1]))
        return file

    def display(
        df, n
    ):  #Takes a pandas.DataFrame and an integer as arguments. This method displays the first n rows of the dataset if n is positive, or the last n rows if n is negative.
        if n >= 0:
            print(df.iloc[0:n])
        else:
            print(df.iloc[n - 1:-1])


pan = FileLoader
file = pan.load(os.getcwd() + "/../resources/athlete_events.csv")
youngestFellah(file, 1992)
コード例 #5
0
from FileLoader import FileLoader
from YoungestFellah import youngestFellah
loader = FileLoader()

data = loader.load("./athlete_events.csv")
youngestFellah(data, 2004)
コード例 #6
0
from YoungestFellah import youngestFellah
from FileLoader import FileLoader

loader = FileLoader()
data = loader.load('../resources/athlete_events.csv')
print(youngestFellah(data, 1992))
コード例 #7
0
from FileLoader import FileLoader
from YoungestFellah import youngestFellah

loader = FileLoader()
data = loader.load('../ex00/athlete_events.csv')
yf = youngestFellah(data, 2012)
print(yf)