0% found this document useful (0 votes)
18 views

Excel_M_DAX_SQL_PYTHON

The document provides a comprehensive list of Excel functions along with their corresponding formulas and descriptions. It also includes equivalent functions in M Language (Power Query) and DAX (Power BI), highlighting their functionalities. Each function is categorized and presented with examples for better understanding.
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Excel_M_DAX_SQL_PYTHON

The document provides a comprehensive list of Excel functions along with their corresponding formulas and descriptions. It also includes equivalent functions in M Language (Power Query) and DAX (Power BI), highlighting their functionalities. Each function is categorized and presented with examples for better understanding.
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 30

S.

No Function Excel Formula


1 SUM 'SUM(A1:A10)
2 AVERAGE 'AVERAGE(A1:A10)
3 IF 'IF(A1>10,"Yes","No")
4 VLOOKUP 'VLOOKUP(1001, A2:C10, 2, FALSE)
5 HLOOKUP 'HLOOKUP(1001, A1:J2, 2, FALSE)
6 INDEX 'INDEX(A2:C10, 3, 2)
7 MATCH 'MATCH(50, A1:A10, 0)
8 CONCATENATE 'CONCATENATE(A1, " ", B1)
9 LEFT 'LEFT(A1, 5)
10 RIGHT 'RIGHT(A1, 5)
S.No Function Excel Formula
11 MID 'MID(A1, 3, 4)
12 LEN 'LEN(A1)
13 TRIM 'TRIM(A1)
14 SUBSTITUTE 'SUBSTITUTE(A1, "old", "new")
15 FIND 'FIND("text", A1)
16 TEXT 'TEXT(A1, "DD/MM/YYYY")
17 NOW 'NOW()
18 TODAY 'TODAY()
19 YEAR 'YEAR(A1)
20 MONTH 'MONTH(A1)
S.No Function Excel Formula
21 DAY 'DAY(A1)
22 EOMONTH 'EOMONTH(A1, 1)
23 DATEDIF 'DATEDIF(A1, B1, "Y")
24 TEXTJOIN 'TEXTJOIN(", ", TRUE, A1:A5)
25 ROUND 'ROUND(A1, 2)
26 RAND 'RAND()
27 COUNT 'COUNT(A1:A10)
28 POWER 'POWER(A1, 3)
29 CEILING 'CEILING(A1, 5)
30 FLOOR 'FLOOR(A1, 5)
S.No Function Excel Formula
31 MOD 'MOD(A1, 3)
32 SUMPRODUCT 'SUMPRODUCT(A1:A5, B1:B5)
33 REPLACE 'REPLACE(A1, 2, 3, "xyz")
34 SEARCH 'SEARCH("abc", A1)
35 UPPER 'UPPER(A1)
36 LOWER 'LOWER(A1)
37 PROPER 'PROPER(A1)
38 IFERROR 'IFERROR(A1/B1, "Error")
39 ISERROR 'ISERROR(A1/B1)
40 ISNUMBER 'ISNUMBER(A1)
S.No Function Excel Formula
41 INDEX-MATCH 'INDEX(A1:A10, MATCH(5, B1:B10, 0))
42 INDIRECT 'INDIRECT(A1)
43 MIN 'MIN(A1:A10)
44 MAX 'MAX(A1:A10)
45 RANK 'RANK(A1, A1:A10, 0)
46 PERCENTILE 'PERCENTILE(A1:A10, 0.5)
47 QUARTILE 'QUARTILE(A1:A10, 1)
48 NETWORKDAYS 'NETWORKDAYS(A1, B1)
49 WORKDAY 'WORKDAY(A1, 10)
50 DAYS 'DAYS(B1, A1)
Excel Description
Adds up all values in a range
Computes the mean (average) of a range
Returns different values based on a condition
Searches for a value in the first column and returns data from another column
Searches for a value in the first row and returns data from another row
Returns the value of a specific row and column from a range
Returns the position of a value in a range
Joins multiple text values into one string
Extracts the first N characters from a text string
Extracts the last N characters from a text string
Excel Description
Extracts a substring from a text string starting at a given position
Returns the number of characters in a text string
Removes extra spaces from a text string
Replaces occurrences of a substring in a text string
Returns the position of a substring within a text string (case-sensitive)
Formats a value as text in a specific format
Returns the current date and time
Returns the current date (without time)
Extracts the year from a date
Extracts the month from a date
Excel Description
Extracts the day from a date
Returns the last day of the month, a specified number of months in the future or past
Calculates the difference between two dates in years, months, or days
Joins multiple text values using a delimiter
Rounds a number to a specified number of decimal places
Returns a random number between 0 and 1
Counts the number of numeric values in a range
Raises a number to a specified power
Rounds a number up to the nearest multiple of a given number
Rounds a number down to the nearest multiple of a given number
Excel Description
Returns the remainder after division
Multiplies corresponding elements in arrays and returns the sum
Replaces part of a text string with another string
Finds the position of a substring (case-insensitive)
Converts text to uppercase
Converts text to lowercase
Capitalizes the first letter of each word
Returns a value if no error occurs, otherwise returns a custom value
Returns TRUE if the expression results in an error
Checks if a value is a number
Excel Description
Returns the value at a specific row based on a lookup
Returns a reference specified by a text string
Returns the smallest number in a range
Returns the largest number in a range
Returns the rank of a number within a list
Returns the k-th percentile of values in a range
Returns the quartile of a dataset
Returns the number of working days between two dates
Returns the date after adding a given number of working days
Returns the number of days between two dates
Excel Example
'=SUM(A1:A10)
'=AVERAGE(A1:A10)
'=IF(A1>10,"Yes","No")
'=VLOOKUP(1001, A2:C10, 2, FALSE)
'=HLOOKUP(1001, A1:J2, 2, FALSE)
'=INDEX(A2:C10, 3, 2)
'=MATCH(50, A1:A10, 0)
'=CONCATENATE(A1, " ", B1)
'=LEFT(A1, 5)
'=RIGHT(A1, 5)
Excel Example
'=MID(A1, 3, 4)
'=LEN(A1)
'=TRIM(A1)
'=SUBSTITUTE(A1, "old", "new")
'=FIND("World", A1)
'=TEXT(A1, "DD/MM/YYYY")
'=NOW()
'=TODAY()
'=YEAR(A1)
'=MONTH(A1)
Excel Example
'=DAY(A1)
'=EOMONTH(A1, 1)
'=DATEDIF(A1, B1, "Y")
'=TEXTJOIN(", ", TRUE, A1:A5)
'=ROUND(A1, 2)
'=RAND()
'=COUNT(A1:A10)
'=POWER(A1, 3)
'=CEILING(A1, 5)
'=FLOOR(A1, 5)
Excel Example
'=MOD(10, 3) → 1
'=SUMPRODUCT(A1:A5, B1:B5)
'=REPLACE("hello", 2, 3, "xyz") → "hxyzlo"
'=SEARCH("cat", "My Cat") → 4
'=UPPER("hello") → "HELLO"
'=LOWER("HELLO") → "hello"
'=PROPER("hello world") → "Hello World"
'=IFERROR(10/0, "Error") → "Error"
'=ISERROR(10/0) → TRUE
'=ISNUMBER(123) → TRUE
Excel Example
'=INDEX(A1:A10, MATCH(5, B1:B10, 0))
'=INDIRECT("B2") → Value in B2
'=MIN(A1:A10) → Smallest value
'=MAX(A1:A10) → Largest value
'=RANK(5, A1:A10, 0)
'=PERCENTILE(A1:A10, 0.5)
'=QUARTILE(A1:A10, 1)
'=NETWORKDAYS("2024-01-01", "2024-01-10")
'=WORKDAY("2024-01-01", 10)
'=DAYS("2024-01-10", "2024-01-01") → 9
M Language (Power Query)
List.Sum({1,2,3})
List.Average({1,2,3})
if Condition then "Yes" else "No"
Table.SelectRows
Table.Transpose + Table.SelectRows
Table.Column + List.PositionOf
List.PositionOf
Text.Combine
Text.Start
Text.End
M Language (Power Query)
Text.Middle
Text.Length
Text.Trim
Text.Replace
Text.PositionOf
Date.ToText
DateTime.LocalNow
Date.From(DateTime.LocalNow())
Date.Year
Date.Month
M Language (Power Query)
Date.Day
Date.EndOfMonth
No direct equivalent
Text.Combine
Number.Round
Number.RandomBetween
List.Count
Number.Power
Number.Ceiling
Number.Floor
M Language (Power Query)
Number.Mod
No direct equivalent
Text.ReplaceRange
Text.PositionOf
Text.Upper
Text.Lower
No direct equivalent
try ... otherwise
try ... otherwise
Value.Is
M Language (Power Query)
No direct equivalent
No direct equivalent
List.Min
List.Max
No direct equivalent
No direct equivalent
No direct equivalent
No direct equivalent
No direct equivalent
Duration.Days
M Description
Adds up all numbers in a list
Computes the mean (average) of a list
Returns values based on a condition
Finds rows based on a condition
Finds values by transposing the table first
Retrieves a value by position from a table column
Returns the position of a value in a list
Joins multiple text values into one string
Extracts the first N characters from a text string
Extracts the last N characters from a text string
M Description
Extracts a substring from a text string
Returns the number of characters in a text string
Removes extra spaces from a text string
Replaces occurrences of a substring in a text string
Returns the position of a substring (case-sensitive)
Converts a date or number to a text format
Returns the current date and time
Returns the current date without time
Extracts the year from a date
Extracts the month from a date
M Description
Extracts the day from a date
Returns the last day of the month
Workaround using Duration functions
Joins multiple text values using a delimiter
Rounds a number to a specified decimal place
Generates a random number
Counts the number of numeric values in a list
Raises a number to a specified power
Rounds a number up to the nearest multiple
Rounds a number down to the nearest multiple
M Description
Returns the remainder after division
Use List.Transform to multiply elements and sum
Replaces part of a text string
Finds the position of a substring
Converts text to uppercase
Converts text to lowercase
Workaround using Text.Split & Text.Upper
Catches and handles errors
Evaluates whether an error occurs
Checks if a value is a number
M Description
Use List.PositionOf to find a match and return the corresponding value
Power Query does not support indirect referencing
Returns the smallest number in a list
Returns the largest number in a list
Use Table.AddRankColumn to assign ranks
Use List.Sort and calculate index
Use List.Sort and calculate position
Use List.Generate and filter weekends
Use List.Generate to exclude weekends
Returns the number of days between two dates
M Example
List.Sum({1,2,3})
List.Average({1,2,3})
if [Sales] > 10 then "Yes" else "No"
Table.SelectRows(Sales, each [ID] = 1001){0}[Amount]
Table.SelectRows(Table.Transpose(Sales), each [Column1] = 1001)
Table.Column(Sales, "Amount"){2}
List.PositionOf({10,20,50}, 50) + 1
Text.Combine({"Hello", "World"}, " ")
Text.Start("HelloWorld", 5)
Text.End("HelloWorld", 5)
M Example
Text.Middle("HelloWorld", 3, 4)
Text.Length("Hello")
Text.Trim(" Hello World ")
Text.Replace("Hello World", "World", "Everyone")
Text.PositionOf("Hello World", "World")
Date.ToText(#date(2023, 3, 5), "dd/MM/yyyy")
DateTime.LocalNow()
Date.From(DateTime.LocalNow())
Date.Year(#date(2023, 3, 5))
Date.Month(#date(2023, 3, 5))
M Example
Date.Day(#date(2023, 3, 5))
Date.EndOfMonth(#date(2023, 3, 5))
Duration.TotalDays(Date.From(B1) - Date.From(A1)) / 365
Text.Combine({"Apple", "Banana"}, ", ")
Number.Round(12.3456, 2)
Number.RandomBetween(0,1)
List.Count({1, 2, 3, null, 5})
Number.Power(5, 3)
Number.Ceiling(12.3, 5)
Number.Floor(12.3, 5)
M Example
Number.Mod(10, 3)
List.Sum(List.Transform(A, each _ * B))
Text.ReplaceRange("hello", 1, 3, "xyz")
Text.PositionOf("My Cat", "cat", Occurrence.First, Comparer.OrdinalIgnoreCase)
Text.Upper("hello")
Text.Lower("HELLO")
Text.Combine(List.Transform(Text.Split("hello world", " "), each Text.Upper(Text.Start(_,1)) & Text.Lower(Text.R
try A / B otherwise "Error"
try A / B otherwise true
Value.Is(123, type number)
M Example
A{List.PositionOf(B, 5)}

List.Min(A)
List.Max(A)
Table.AddRankColumn(...)
List.Sort(A){index}
List.Sort(A){quartileIndex}


Duration.Days(Date.ToRecord(#date(2024,1,10) - #date(2024,1,1)))
DAX (Power BI)
SUM('Table'[Column])
AVERAGE('Table'[Column])
IF(Condition, "Yes", "No")
LOOKUPVALUE(Column, LookupColumn, Value)
LOOKUPVALUE (with TREATAS)
SELECTCOLUMNS or LOOKUPVALUE
MATCH()
CONCATENATE()
LEFT()
RIGHT()
DAX (Power BI)
MID()
LEN()
TRIM()
SUBSTITUTE()
FIND()
FORMAT()
NOW()
TODAY()
YEAR()
MONTH()
DAX (Power BI)
DAY()
EOMONTH()
No direct equivalent
CONCATENATEX()
ROUND()
RAND()
COUNT()
POWER()
CEILING()
FLOOR()
DAX (Power BI)
MOD()
SUMX()
REPLACE()
SEARCH()
UPPER()
LOWER()
No direct equivalent
IFERROR()
ISERROR()
ISNUMBER()
DAX (Power BI)
No direct equivalent
No direct equivalent
MIN()
MAX()
RANKX()
No direct equivalent
No direct equivalent
No direct equivalent
No direct equivalent
DATEDIFF()
DAX Description
Adds up all numbers in a column
Computes the mean (average) of a column
Returns values based on a condition
Searches for a value and returns corresponding data
Searches for a value and returns corresponding data
Retrieves a value from a column by position
Returns the position of a value in a column
Joins multiple text values into one string
Extracts the first N characters from a text string
Extracts the last N characters from a text string
DAX Description
Extracts a substring from a text string
Returns the number of characters in a text string
Removes extra spaces from a text string
Replaces occurrences of a substring in a text string
Returns the position of a substring in a text string
Formats a value as text in a specific format
Returns the current date and time
Returns the current date without time
Extracts the year from a date
Extracts the month from a date
DAX Description
Extracts the day from a date
Returns the last day of the month
Use DATEDIFF instead
Joins multiple text values with a delimiter
Rounds a number to a specified decimal place
Returns a random number between 0 and 1
Counts the number of numeric values in a column
Raises a number to a specified power
Rounds a number up to the nearest multiple
Rounds a number down to the nearest multiple
DAX Description
Returns the remainder after division
Multiplies corresponding elements and sums
Replaces part of a text string
Finds the position of a substring
Converts text to uppercase
Converts text to lowercase
Use FORMAT workaround
Returns a value if no error occurs, otherwise a custom value
Checks if an expression results in an error
Checks if a value is a number
DAX Description
Use LOOKUPVALUE instead
DAX does not support indirect referencing
Returns the smallest number in a column
Returns the largest number in a column
Returns the rank of a number
Use PERCENTILEX.INC instead
Use PERCENTILEX.INC for quartiles
DAX does not have a direct equivalent
DAX does not have a direct equivalent
Returns the number of days between two dates
DAX Example
SUM(Sales[Amount])
AVERAGE(Sales[Amount])
IF([Sales] > 10, "Yes", "No")
LOOKUPVALUE(Sales[Amount], Sales[ID], 1001)
LOOKUPVALUE(Sales[Amount], Sales[ID], 1001)
SELECTCOLUMNS(Sales, "Amount")
MATCH(50, Sales[Amount], 0)
CONCATENATE([First Name], " ", [Last Name])
LEFT([Column], 5)
RIGHT([Column], 5)
DAX Example
MID([Column], 3, 4)
LEN([Column])
TRIM([Column])
SUBSTITUTE([Column], "old", "new")
FIND("World", [Column])
FORMAT([Date], "DD/MM/YYYY")
NOW()
TODAY()
YEAR([Date])
MONTH([Date])
DAX Example
DAY([Date])
EOMONTH([Date], 1)
DATEDIFF([Start Date], [End Date], YEAR)
CONCATENATEX(Table, [Column], ", ")
ROUND([Value], 2)
RAND()
COUNT([Column])
POWER([Column], 3)
CEILING([Column], 5)
FLOOR([Column], 5)
DAX Example
MOD([Column], 3)
SUMX(Table, [Column1] * [Column2])
REPLACE([Column], 2, 3, "xyz")
SEARCH("abc", [Column])
UPPER([Column])
LOWER([Column])
FORMAT([Column], "Proper Case")
IFERROR([Column], "Error")
ISERROR([Column])
ISNUMBER([Column])
DAX Example
LOOKUPVALUE(Table[Value], Table[Key], 5)

MIN([Column])
MAX([Column])
RANKX(ALL(Table), Table[Value], , DESC)
PERCENTILEX.INC(Table, Table[Value], 0.5)
PERCENTILEX.INC(Table, Table[Value], 0.25)


DATEDIFF([StartDate], [EndDate], DAY)
SQL Equivalent
SUM(column_name)
AVG(column_name)
CASE WHEN condition THEN 'Yes' ELSE 'No' END
LEFT JOIN
CROSS JOIN with filtering
OFFSET
ROW_NUMBER()
CONCAT(column1, column2)
LEFT(column_name, n)
RIGHT(column_name, n)
SQL Equivalent
SUBSTRING(column, start, length)
LENGTH(column_name)
TRIM(column_name)
REPLACE(column, old, new)
POSITION(substring IN column)
TO_CHAR(column, format)
CURRENT_TIMESTAMP
CURRENT_DATE
EXTRACT(YEAR FROM column)
EXTRACT(MONTH FROM column)
SQL Equivalent
EXTRACT(DAY FROM column)
LAST_DAY(column)
DATEDIFF()
STRING_AGG(column, delimiter)
ROUND(column, decimals)
RAND()
COUNT(column)
POWER(column, exponent)
CEIL(column / multiple) * multiple
FLOOR(column / multiple) * multiple
SQL Equivalent
%
SUM(A*B)
STUFF()
POSITION()
UPPER()
LOWER()
INITCAP()
COALESCE()
CASE WHEN ... IS NULL
CASE WHEN column ~ '^\d+$' THEN TRUE ELSE FALSE
SQL Equivalent
JOIN + WHERE
Dynamic SQL
MIN()
MAX()
RANK()
PERCENTILE_CONT()
PERCENTILE_CONT()
DATEDIFF() with conditions
CASE + INTERVAL
DATEDIFF()
SQL Description
Computes sum of column values
Computes the mean (average) of a column
Executes conditional logic
Joins tables to find matching values
Finds row-wise lookup values
Retrieves a value from a column based on position
Assigns a row number to values in order
Joins multiple text values into one string
Extracts the first N characters from a text string
Extracts the last N characters from a text string
SQL Description
Extracts a substring from a text field
Returns the number of characters in a text string
Removes extra spaces from a text string
Replaces occurrences of a substring in a text field
Returns the position of a substring
Converts a value to text format
Returns the current date and time
Returns the current date without time
Extracts the year from a date
Extracts the month from a date
SQL Description
Extracts the day from a date
Returns the last day of the month
Returns difference between two dates
Joins multiple text values using a delimiter
Rounds a number to a specified decimal place
Returns a random number between 0 and 1
Counts the number of numeric values in a column
Raises a number to a specified power
Rounds a number up
Rounds a number down
SQL Description
Returns the remainder after division
Multiplies and sums corresponding elements
Replaces part of a text string
Finds the position of a substring
Converts text to uppercase
Converts text to lowercase
Capitalizes the first letter of each word
Returns first non-null value
Checks for errors
Checks if a value is a number
SQL Description
Used together to achieve index-match behavior
SQL requires dynamic queries
Returns the smallest value in a column
Returns the largest value in a column
Returns the rank of a number within a group
Returns the percentile value
Returns the quartile value
Count weekdays in date range
Adds business days to a date
Returns the number of days between two dates
SQL Examp
SELECT SUM(sales) FROM SalesTable;
SELECT AVG(sales) FROM SalesTable;
SELECT CASE WHEN sales > 10 THEN 'Yes' ELSE 'No' END FROM SalesTable;
SELECT B.amount FROM A LEFT JOIN B ON A.ID = B.ID WHERE A.ID = 1001;
SELECT * FROM (SELECT column_name FROM table) AS subquery WHERE id = 1001;
SELECT column_name FROM table_name LIMIT 1 OFFSET 2;
SELECT ROW_NUMBER() OVER (ORDER BY Amount) FROM SalesTable;
SELECT CONCAT(first_name, ' ', last_name) FROM Employees;
SELECT LEFT(name, 5) FROM Employees;
SELECT RIGHT(name, 5) FROM Employees;
SQL Examp
SELECT SUBSTRING(name, 3, 4) FROM Employees;
SELECT LENGTH(name) FROM Employees;
SELECT TRIM(name) FROM Employees;
SELECT REPLACE(name, 'old', 'new') FROM Employees;
SELECT POSITION('World' IN name) FROM Employees;
SELECT TO_CHAR(date_column, 'DD/MM/YYYY') FROM Orders;
SELECT CURRENT_TIMESTAMP;
SELECT CURRENT_DATE;
SELECT EXTRACT(YEAR FROM order_date) FROM Orders;
SELECT EXTRACT(MONTH FROM order_date) FROM Orders;
SQL Examp
SELECT EXTRACT(DAY FROM order_date) FROM Orders;
SELECT LAST_DAY(order_date) FROM Orders;
SELECT DATEDIFF(YEAR, start_date, end_date) FROM Orders;
SELECT STRING_AGG(name, ', ') FROM Employees;
SELECT ROUND(price, 2) FROM Products;
SELECT RAND();
SELECT COUNT(*) FROM Employees;
SELECT POWER(salary, 3) FROM Employees;
SELECT CEIL(price / 5) * 5 FROM Products;
SELECT FLOOR(price / 5) * 5 FROM Products;
SQL Examp
SELECT 10 % 3;
SELECT SUM(A * B) FROM Table;
SELECT STUFF('hello', 2, 3, 'xyz');
SELECT POSITION('cat' IN 'My Cat');
SELECT UPPER(name) FROM Employees;
SELECT LOWER(name) FROM Employees;
SELECT INITCAP(name) FROM Employees;
SELECT COALESCE(NULL, 'Error');
SELECT CASE WHEN A / B IS NULL THEN TRUE ELSE FALSE END FROM Table;
SELECT CASE WHEN '123' ~ '^\d+$' THEN TRUE ELSE FALSE END;
SQL Examp
SELECT A.value FROM A JOIN B ON A.id = B.id WHERE B.value = 5;
EXEC('SELECT ' + columnName + ' FROM Table');
SELECT MIN(column) FROM Table;
SELECT MAX(column) FROM Table;
SELECT RANK() OVER (ORDER BY column DESC) FROM Table;
SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY column) FROM Table;
SELECT PERCENTILE_CONT(0.25) WITHIN GROUP (ORDER BY column) FROM Table;
SELECT COUNT(*) FROM (SELECT generate_series('2024-01-01'::date, '2024-01-10'::date, '1 day') AS dt WHERE
SELECT DATEADD('day', 10, '2024-01-01') WHERE EXTRACT(DOW FROM DATEADD('day', 10, '2024-01-01')) BET
SELECT DATEDIFF(DAY, '2024-01-01', '2024-01-10');
Pandas Equivalent
df['column'].sum()
df['column'].mean()
df['column'].apply(lambda x: "Yes" if x>10 else "No")
df.merge(df2, on='ID', how='left')
df.T[df.T.index == 1001]
df.iloc[row, col]
df[df['column'] == 50].index[0]
df['column1'] + " " + df['column2']
df['column'].str[:5]
df['column'].str[-5:]
Pandas Equivalent
df['column'].str[2:6]
df['column'].str.len()
df['column'].str.strip()
df['column'].str.replace("old", "new")
df['column'].str.find("text")
df['column'].dt.strftime("%d/%m/%Y")
pd.Timestamp.now()
pd.Timestamp.today().date()
df['column'].dt.year
df['column'].dt.month
Pandas Equivalent
df['column'].dt.day
df['column'] + MonthEnd(1)
(df['end_date'] - df['start_date']).dt.days / 365
', '.join(df['column'])
df['column'].round(2)
np.random.rand()
df['column'].count()
df['column'] ** 3
np.ceil(df['column'] / 5) * 5
np.floor(df['column'] / 5) * 5
Pandas Equivalent
%
np.dot()
.str.slice_replace()
.str.find()
.str.upper()
.str.lower()
.str.title()
.fillna()
.isna()
.apply(lambda x: isinstance(x, (int, float)))
Pandas Equivalent
.loc[]
.eval()
.min()
.max()
.rank()
.quantile()
.quantile()
pd.bdate_range()
pd.offsets.BDay()
pd.Timedelta()
Pandas Description
Computes sum of column values in a Pandas DataFrame
Computes the mean (average) of a Pandas Series
Returns values based on a condition
Joins tables to find matching values
Finds values by transposing the DataFrame
Retrieves a value from a DataFrame based on row/column index
Finds the index of a value in a DataFrame column
Joins multiple text values into one string
Extracts the first N characters from a Pandas Series
Extracts the last N characters from a Pandas Series
Pandas Description
Extracts a substring from a Pandas Series
Returns the number of characters in a Pandas Series
Removes extra spaces from a Pandas Series
Replaces occurrences of a substring in a Pandas Series
Returns the position of a substring in a Pandas Series
Converts a date column to a string in Pandas
Returns the current date and time in Pandas
Returns the current date in Pandas
Extracts the year from a date column in Pandas
Extracts the month from a date column in Pandas
Pandas Description
Extracts the day from a date column in Pandas
Returns the last day of the month in Pandas
Calculates difference between two dates in Pandas
Joins multiple text values in Pandas
Rounds a number to a specified decimal place in Pandas
Returns a random number between 0 and 1 in Pandas
Counts non-null values in a Pandas column
Raises a number to a specified power in Pandas
Rounds a number up in Pandas
Rounds a number down in Pandas
Pandas Description
Returns the remainder after division
Computes dot product (similar to SUMPRODUCT)
Replaces part of a text string
Finds the position of a substring
Converts text to uppercase
Converts text to lowercase
Capitalizes the first letter of each word
Replaces errors with a specified value
Checks if values are NaN (similar to errors)
Checks if a value is a number
Pandas Description
Retrieves a value using row index and match
Evaluates a string as a column reference
Returns the smallest value in a column
Returns the largest value in a column
Returns ranks of numbers in a column
Returns the k-th percentile of a column
Returns the quartile value
Returns business days count between two dates
Returns the date after adding business days
Returns the number of days between two dates
Pandas Example
df['sales'].sum()
df['sales'].mean()
df['sales'].apply(lambda x: "Yes" if x > 10 else "No")
df1.merge(df2, on='ID', how='left')
df.T.loc[:, 1001]
df.iloc[2,1]
df[df['amount'] == 50].index[0]
df['first_name'] + " " + df['last_name']
df['name'].str[:5]
df['name'].str[-5:]
Pandas Example
df['name'].str[2:6]
df['name'].str.len()
df['name'].str.strip()
df['name'].str.replace("old", "new")
df['name'].str.find("World")
df['date'].dt.strftime("%d/%m/%Y")
pd.Timestamp.now()
pd.Timestamp.today().date()
df['date'].dt.year
df['date'].dt.month
Pandas Example
df['date'].dt.day
df['date'] + pd.offsets.MonthEnd(1)
(df['end_date'] - df['start_date']).dt.days / 365
', '.join(df['name'])
df['price'].round(2)
np.random.rand()
df['salary'].count()
df['salary'] ** 3
np.ceil(df['price'] / 5) * 5
np.floor(df['price'] / 5) * 5
Pandas Example
df['column'] % 3
np.dot(df['A'], df['B'])
df['column'].str.slice_replace(1, 3, 'xyz')
df['column'].str.find('cat')
df['column'].str.upper()
df['column'].str.lower()
df['column'].str.title()
df['column'].replace(np.nan, 'Error')
df['column'].isna()
df['column'].apply(lambda x: isinstance(x, (int, float)))
Pandas Example
df.loc[df['B'] == 5, 'A'].values[0]
df.eval('B2')
df['column'].min()
df['column'].max()
df['column'].rank(ascending=False)
df['column'].quantile(0.5)
df['column'].quantile(0.25)
len(pd.bdate_range(start='2024-01-01', end='2024-01-10'))
pd.Timestamp('2024-01-01') + pd.offsets.BDay(10)
(pd.to_datetime('2024-01-10') - pd.to_datetime('2024-01-01')).days

You might also like