Naval WS4 PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

B

With open (‘the_zen_of_python.txt’, ‘r’) as file:


Print(file.readline())
Print(file.readline())
Print(file.readline())

Beautiful is better than ugly


Explicit is better than implicit
Simple is better than complex

import numpy as np

import matplotlib.pyplot as plt

file = '../_datasets/seaslug.txt'

data = np.loadtxt(file, delimiter='\t',


dtype=str)

print(data[0])

data_float = np.loadtxt(file, delimiter='\t',


dtype=float, skiprows=1)

print(data_float[9])
import pandas as pd

file = '../_datasets/battledeath.xlsx'

xl = pd.ExcelFile(file)

df1 = xl.parse(0, skiprows=[0], names=['Country', 'AAM due to War


(2002)'])

print(df1.head())

df2 = xl.parse(0, parse_cols=[0], skiprows=[0], names=['Country']

if I < 5:

print (line)

You might also like