Telegram Group & Telegram Channel
Python for Data Analytics - Quick Cheatsheet with Cod e Example 🚀

1️⃣ Data Manipulation with Pandas

import pandas as pd  
df = pd.read_csv("data.csv")
df.to_excel("output.xlsx")
df.head()
df.info()
df.describe()
df[df["sales"] > 1000]
df[["name", "price"]]
df.fillna(0, inplace=True)
df.dropna(inplace=True)


2️⃣ Numerical Operations with NumPy

import numpy as np  
arr = np.array([1, 2, 3, 4])
print(arr.shape)
np.mean(arr)
np.median(arr)
np.std(arr)


3️⃣ Data Visualization with Matplotlib & Seaborn


import matplotlib.pyplot as plt  
plt.plot([1, 2, 3, 4], [10, 20, 30, 40])
plt.bar(["A", "B", "C"], [5, 15, 25])
plt.show()
import seaborn as sns
sns.heatmap(df.corr(), annot=True)
sns.boxplot(x="category", y="sales", data=df)
plt.show()


4️⃣ Exploratory Data Analysis (EDA)

df.isnull().sum()  
df.corr()
sns.histplot(df["sales"], bins=30)
sns.boxplot(y=df["price"])


5️⃣ Working with Databases (SQL + Python)

import sqlite3  
conn = sqlite3.connect("database.db")
df = pd.read_sql("SELECT * FROM sales", conn)
conn.close()
cursor = conn.cursor()
cursor.execute("SELECT AVG(price) FROM products")
result = cursor.fetchone()
print(result)


React with ❤️ for more

Share with credits: https://www.tg-me.com/sqlspecialist

Hope it helps :)



tg-me.com/pythonanalyst/949
Create:
Last Update:

Python for Data Analytics - Quick Cheatsheet with Cod e Example 🚀

1️⃣ Data Manipulation with Pandas

import pandas as pd  
df = pd.read_csv("data.csv")
df.to_excel("output.xlsx")
df.head()
df.info()
df.describe()
df[df["sales"] > 1000]
df[["name", "price"]]
df.fillna(0, inplace=True)
df.dropna(inplace=True)


2️⃣ Numerical Operations with NumPy

import numpy as np  
arr = np.array([1, 2, 3, 4])
print(arr.shape)
np.mean(arr)
np.median(arr)
np.std(arr)


3️⃣ Data Visualization with Matplotlib & Seaborn


import matplotlib.pyplot as plt  
plt.plot([1, 2, 3, 4], [10, 20, 30, 40])
plt.bar(["A", "B", "C"], [5, 15, 25])
plt.show()
import seaborn as sns
sns.heatmap(df.corr(), annot=True)
sns.boxplot(x="category", y="sales", data=df)
plt.show()


4️⃣ Exploratory Data Analysis (EDA)

df.isnull().sum()  
df.corr()
sns.histplot(df["sales"], bins=30)
sns.boxplot(y=df["price"])


5️⃣ Working with Databases (SQL + Python)

import sqlite3  
conn = sqlite3.connect("database.db")
df = pd.read_sql("SELECT * FROM sales", conn)
conn.close()
cursor = conn.cursor()
cursor.execute("SELECT AVG(price) FROM products")
result = cursor.fetchone()
print(result)


React with ❤️ for more

Share with credits: https://www.tg-me.com/sqlspecialist

Hope it helps :)

BY Python for Data Analysts


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/pythonanalyst/949

View MORE
Open in Telegram


telegram Telegram | DID YOU KNOW?

Date: |

How Does Bitcoin Mining Work?

Bitcoin mining is the process of adding new transactions to the Bitcoin blockchain. It’s a tough job. People who choose to mine Bitcoin use a process called proof of work, deploying computers in a race to solve mathematical puzzles that verify transactions.To entice miners to keep racing to solve the puzzles and support the overall system, the Bitcoin code rewards miners with new Bitcoins. “This is how new coins are created” and new transactions are added to the blockchain, says Okoro.

Telegram announces Search Filters

With the help of the Search Filters option, users can now filter search results by type. They can do that by using the new tabs: Media, Links, Files and others. Searches can be done based on the particular time period like by typing in the date or even “Yesterday”. If users type in the name of a person, group, channel or bot, an extra filter will be applied to the searches.

telegram from us


Telegram Python for Data Analysts
FROM USA