Skip to content

keerthy-analyst/PhonePe-Pulse_Data_Visualization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PHONEPE_PULSE_DATA_VISUALIZATION - PROJECT 2

#reference for phonepe pulse data: https://github.com/PhonePe/pulse

Required libraries to be imported

import streamlit as st
from PIL import Image
import os
import json
from streamlit_option_menu import option_menu
import pandas as pd
import sqlite3
import plotly.express as px

For cloning data using this command

import requests
response = requests.get(url)
repo = response.json()
clone_url = repo['clone_url']
repo_name = "pulse"
clone_dir = os.path.join(os.getcwd(), repo_name)

Creating dataframes using Pandas

clm={'State':[], 'Year':[],'Quater':[],'Transaction_type':[], 'Transaction_count':[], 'Transaction_amount':[]}
for i in Agg_state_list:
    p_i=path+i+"/"
    Agg_yr=os.listdir(p_i)
    for j in Agg_yr:
        p_j=p_i+j+"/"
        Agg_yr_list=os.listdir(p_j)
        for k in Agg_yr_list:
            p_k=p_j+k
            Data=open(p_k,'r')
            D=json.load(Data)
            for z in D['data']['transactionData']:
              Name=z['name']
              count=z['paymentInstruments'][0]['count']
              amount=z['paymentInstruments'][0]['amount']
              clm['Transaction_type'].append(Name)
              clm['Transaction_count'].append(count)
              clm['Transaction_amount'].append(amount)
              clm['State'].append(i)
              clm['Year'].append(j)
              clm['Quater'].append(int(k.strip('.json')))

# Successfully created a dataframe
df_aggregated_transaction=pd.DataFrame(clm)

Create the app using streamlitReference\

Visualizing the data with plotly and streamlit

 fig=px.bar(df,x=column name,y=column name)
            tab1, tab2 = st.tabs(["Streamlit theme (default)", "Plotly native theme"])
            with tab1:
                st.plotly_chart(fig, theme="streamlit", use_container_width=True)
            with tab2:
                st.plotly_chart(fig, theme=None, use_container_width=True)

Visualization of the Phonepe_pulse_data

Screenshot 2023-03-10 061726 image_2023-03-10_062004520

You can now view your Streamlit app in your browser.

'''Local URL: http://localhost:8501 Network URL: http://192.168.0.102:8501'''

Releases

No releases published

Packages

No packages published

Languages