Giter Club home page Giter Club logo

perform-log-transformation-on-international-airline-passenger-data's Introduction

EX-3 Perform-log-transformation-on-international-airline-passenger-data

AIM:

To Write a Program to log transformation on international airline passenger data

Equipments Required:

  1. Hardware โ€“ PCs
  2. Anaconda โ€“ Python 3.7 Installation / Jupyter notebook

Procedure:

1.import the numpy ,pandas and matplotlib.pyplot modules
2.read the dataset using pandas
3.applying log transformation for dataset
4.Plot the trend dataset 
5.plot the log transformation data

Program:

/*4
log transformation on international airline passenger data

Developed by: Praveen s
RegisterNumber:  212222240077
*/
import pandas as pd
import numpy as np
import matplotlib.pylab as plt
%matplotlib inline
from matplotlib.pylab import rcParams
from datetime import datetime
data=pd.read_csv(r'/content/AirPassengers.csv')
data.head()

data.tail()

data.shape

data['Month']=pd.to_datetime(data['Month'], infer_datetime_format=True)
data=data.set_index(['Month'])
data

plt.figure(figsize=(20,10))
plt.xlabel("Month")
plt.ylabel("Air Passengers Count")
plt.plot(data)

trend = data['#Passengers'].rolling(window=12).mean()

# Plot the trend
plt.plot(trend)
plt.xlabel('Month')
plt.ylabel('Trend')
plt.show()

seasonality = data['#Passengers'] - trend
# Plot the seasonality
plt.plot(seasonality)
plt.xlabel('Month')
plt.ylabel('Seasonality')
plt.show()

# @title
# Apply log transformation to the data
log_data = np.log(data)

# Plot the original data and the log-transformed data
import matplotlib.pyplot as plt
#plt.hist(data, bins=50, label='Original Data')

plt.plot(log_data)
plt.legend()
plt.show()

Output:

data.head()

s1

data.tail()

s2

data.shape

s3

data

s4

Graph for datasets

s5

Trend graph

s6

seasonality graph

s7

log-transformed data

s8

Result:

Thus the program to t log transformation on international airline passenger data is written and verified using python programming.

perform-log-transformation-on-international-airline-passenger-data's People

Contributors

praveenst13 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.