Giter VIP home page Giter VIP logo

mo_week_10's Introduction

Data Manipulation

The notebook manipulates the data in several ways, including:

  • Converting the date column to a date format.
  • Adding columns for the hour, day of week, and month.
  • Adding window functions to calculate ranking and statistical measures.

Data Visualization

The notebook visualizes the data using several charts, including as shown in the notebook:

  • A bar chart of the top device categories.
  • A line chart of daily visitors.
  • A bar chart of average daily visitors by weekday.
  • A histogram of bounce rate.

Example Spark SQL Query

The notebook includes one Spark SQL query that is used to calculate the ranking and statistical measures. The query is: This query calculates several ranking and statistical measures, including the row number, rank, dense rank, count, first, last, minimum, maximum, nth value, lag, lead, percent rank, and ntile.

SELECT *,
  date_format(to_timestamp(timestamp), "H") AS hour,
  date_format(to_timestamp(timestamp), "E") AS dayofweek,
  row_number() OVER (PARTITION BY `Device Category` ORDER BY timestamp) AS row_num,
  rank() OVER (PARTITION BY `Device Category` ORDER BY timestamp) AS rank,
  dense_rank() OVER (PARTITION BY `Device Category` ORDER BY timestamp) AS dense_rank,
  count(*) OVER (PARTITION BY `Device Category` ORDER BY timestamp) AS count,
  first(`# of Visitors`) OVER (PARTITION BY `Device Category` ORDER BY timestamp) AS first,
  last(`# of Visitors`) OVER (PARTITION BY `Device Category` ORDER BY timestamp) AS last,
  min(`# of Visitors`) OVER (PARTITION BY `Device Category` ORDER BY timestamp) AS min,
  max(`# of Visitors`) OVER (PARTITION BY `Device Category` ORDER BY timestamp) AS max,
  nth_value(`# of Visitors`, 2) OVER (PARTITION BY `Device Category` ORDER BY timestamp) AS nth,
  lag(`# of Visitors`, 1) OVER (PARTITION BY `Device Category` ORDER BY timestamp) AS lag,
  lead(`# of Visitors`, 1) OVER (PARTITION BY `Device Category` ORDER BY timestamp) AS lead,
  percent_rank() OVER (PARTITION BY `Device Category` ORDER BY timestamp) AS percent,
  ntile(2) OVER (PARTITION BY `Device Category` ORDER BY timestamp) AS ntile
FROM la_tr
ORDER BY `Device Category`, timestamp

Conclusion

This notebook provides a comprehensive analysis of the website traffic for LA City Infrastructure & Service Requests. The analysis includes insights into key metrics, data manipulation techniques, and visualizations. The notebook can be used as a template for other data analysis projects.

mo_week_10's People

Contributors

markoke avatar

Watchers

 avatar  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.