Pandas_info / app.py
Sathwikchowdary's picture
Create app.py
ba11aa1 verified
import streamlit as st
import numpy as np
import pandas as pd
st.title("PANDAS")
st.subheader("What is pandas?")
st.markdown("Pandas is a Python library used for working with data sets.")
st.markdown("It has functions for analyzing, cleaning, exploring, and manipulating data.")
st.markdown("The name Pandas has a reference to both Panel Data, and Python Data Analysis")
st.subheader("Why Use Pandas?")
st.markdown("Pandas allows us to analyze big data and make conclusions based on statistical theories.")
st.markdown("Pandas can clean messy data sets, and make them readable and relevant.")
st.markdown("Relevant data is very important in data science.")
st.subheader("What Can Pandas Do?")
st.markdown("Pandas gives you answers about the data. Like:")
st.write("Is there a correlation between two or more columns?")
st.markdown("What is average value?")
st.markdown("Max value?")
st.markdown("Min value?")
st.subheader("what is cleaning data:")
st.markdown("Pandas are also able to delete rows that are not relevant, or contains wrong values, like empty or NULL values. This is called cleaning the data.")
st.subheader("Installation of Pandas")
st.markdown("If you have Python and PIP already installed on a system, then installation of Pandas is very easy.")
st.markdown("or use a python distribution that already has Pandas installed like, Anaconda, Spyder etc.")
st.subheader("import pandas:")
st.markdown("Once Pandas is installed, import it in your applications by adding the import keyword:")
st.markdown("[import pandas]")
st.markdown("Now Pandas is imported and ready to use.")
st.subheader("Pandas as pd")
st.markdown("Pandas is usually imported under the pd alias.")
st.markdown("it is an alternate name of pandas")
st.markdown("instead of writing pandas we write pd")
st.subheader("Create an alias with the as keyword while importing:")
st.markdown("import pandas as pd")
st.markdown("Now the Pandas package can be referred to as pd instead of pandas.")
st.header("Pandas Series")
st.subheader("What is a Series?")
st.markdown("A Pandas Series is like a column in a table.")
st.markdown("It is a one-dimensional array holding data of any type.")
st.subheader("Example:")
st.markdown("Create a simple Pandas Series from a list:")
st.markdown("import pandas as pd")
st.markdown("a = [1, 7, 2]")
st.markdown("myvar = pd.Series(a)")
st.markdown("print(myvar)")
st.subheader("Output:")
st.markdown("0 , 1")
st.markdown("1 , 7")
st.markdown("2 , 2")
st.markdown("dtype: int64")
st.subheader("Labels:")
st.markdown("If nothing else is specified, the values are labeled with their index number. First value has index 0, second value has index 1 etc.")
st.markdown("This label can be used to access a specified value.")
st.subheader("Example:")
st.markdown("Return the first value of the Series:")
st.markdown("import pandas as pd")
st.markdown("a = [1, 7, 2]")
st.markdown("myvar = pd.Series(a)")
st.markdown("print(myvar[0])")
st.subheader("Output")
st.subheader("1")
st.subheader("Create Labels:")
st.markdown("with the index argument, you can name your own labels.")
st.subheader("Example:")
st.markdown("import pandas as pd")
st.markdown("a = [1, 7, 2]")
st.markdown("myvar = pd.Series a, index = [x, y, z]")
st.markdown("print(myvar)")
st.subheader("Output:")
st.markdown("x , 1")
st.markdown("y , 7")
st.markdown("z , 2")
st.markdown("dtype: int64")
st.markdown("When you have created labels, you can access an item by referring to the label.")
st.subheader("Example:")
st.markdown("Return the value of y:")
st.subheader("import pandas as pd")
st.markdown("a = [1, 7, 2]")
st.markdown("myvar = pd.Series(a, index = [x, y, z])")
st.markdown("print(myvar [y])")
st.subheader("Output:")
st.subheader("7")
st.subheader("Key/Value Objects as Series")
st.markdown("You can also use a key/value object, like a dictionary, when creating a Series.")
st.subheader("Example:")
st.markdown("Create a simple Pandas Series from a dictionary:")
st.markdown("import pandas as pd")
st.markdown("calories = day1 : 420, day2 : 380, day3 : 390")
st.markdown("myvar = pd.Series(calories)")
st.markdown("print(myvar)")
st.subheader("Output:")
st.markdown("day1 420")
st.markdown("day2 380")
st.markdown("day3 390")
st.markdown("dtype: int64")
st.markdown("Note: The keys of the dictionary become the labels.")
st.markdown("To select only some of the items in the dictionary, use the index argument and specify only the items you want to include in the Series.")
st.subheader("Example:")
st.markdown("import pandas as pd")
st.markdown("calories = day1 : 420, day2 : 380, day3 : 390")
st.markdown("myvar = pd.Series(calories, index = [day1, day2])")
st.markdown("print(myvar)")
st.subheader("Output:")
st.markdown("day1 , 420")
st.markdown("day2 , 380")
st.markdown("dtype: int64")
st.subheader("DataFrames:")
st.markdown("Data sets in Pandas are usually multi-dimensional tables, called DataFrames.")
st.markdown("Series is like a column, a DataFrame is the whole table.")
st.subheader("Example:")
st.markdown("Create a DataFrame from two Series:")
st.markdown("import pandas as pd")
st.markdown("data = {")
st.markdown("calories : [420, 380, 390],")
st.markdown("duration: [50, 40, 45]")
st.markdown("}")
st.markdown("myvar = pd.DataFrame(data)")
st.markdown("print(myvar)")
st.subheader("Output:")
st.markdown("calories duration")
st.markdown("0 , 420 , 50")
st.markdown("1 , 380 , 40")
st.markdown("2 , 390 , 45")