Creating Particle Animation in React JS

Ath Tripathi
Updated on 29-Sep-2021 07:56:41

1K+ Views

"Particle animation" is a technique in game physics, motion graphics, and computer graphics that uses many minute sprites, 3D models, or other graphic objects to simulate certain kinds of "fuzzy" phenomena.In this article, we will see how to make a popular particle animation in React JS. We will do this using a third-party package called "react-tsparticles".First create a React project −npx create-react-app tutorialpurposeGo to the project directory −cd tutorialpurposeExampleDownload and install the "react-tsparticles" package −npm install react-tsparticles reactWe will use this package to add default particle animations with different styling elements. You can also add id and different options for ... Read More

Extract Value Names and Counts from Value Counts in Pandas

AmitDiwan
Updated on 29-Sep-2021 07:43:15

411 Views

To extract the value names and counts, let us first create a DataFrame with 4 columns −dataFrame = pd.DataFrame({"Car": ['BMW', 'Mustang', 'Tesla', 'Mustang', 'Mercedes', 'Tesla', 'Audi'], "Cubic Capacity": [2000, 1800, 1500, 2500, 2200, 3000, 2000], "Reg Price": [7000, 1500, 5000, 8000, 9000, 6000, 1500], "Units Sold": [ 200, 120, 150, 120, 210, 250, 220] })Fetch the value names and count for a specific column Car −res = dataFrame['Car'].value_counts() Fetch the value names and count for a specific column Units Sold −res = dataFrame['Units Sold'].value_counts()ExampleFollowing is the complete code −import pandas as pd # creating dataframe dataFrame = pd.DataFrame({"Car": ['BMW', ... Read More

Merge DataFrame with One-to-Many Relation in Python Pandas

AmitDiwan
Updated on 29-Sep-2021 07:35:38

3K+ Views

To merge Pandas DataFrame, use the merge() function. The one-to-many relation is implemented on both the DataFrames by setting under the “validate” parameter of the merge() function i.e. −validate = “one-to-many” or validate = “1:m”The one-to-many relation checks if merge keys are unique in left dataset.At first, let us create our 1st DataFrame −dataFrame1 = pd.DataFrame(    {       "Car": ['BMW', 'Lexus', 'Audi', 'Mustang', 'Bentley', 'Jaguar'], "Units": [100, 150, 110, 80, 110, 90] } )Now, let us create our 2nd DataFrame −dataFrame2 = pd.DataFrame(    {       "Car": ['BMW', 'Lexus', 'Tesla', 'Mustang', 'Mercedes', ... Read More

Create Excel-like Data Grid in React JS

Ath Tripathi
Updated on 29-Sep-2021 07:34:58

1K+ Views

In this article, we will see how to create an Excel-like data grid in React JS frontend. We will use a third-party package for this, which is called react-data-grid. This is a useful package if you are working with data and want to make a dashboard application.First create a react project −npx create-react-app tutorialpurposeGo to the project directory −cd tutorialpurpose ExampleDownload and install the react-data-grid package −npm i --save react-data-gridWe can use this package to add default styled grid tables or you can say data grids which are premade.Add the following lines of code in App.js −import DataGrid from "react-data-grid"; ... Read More

Merge and Create Cartesian Product from DataFrames in Python Pandas

AmitDiwan
Updated on 29-Sep-2021 07:21:01

2K+ Views

To merge Pandas DataFrame, use the merge() function. The cartesian product is implemented on both the DataFrames by setting under the “how” parameter of the merge() function i.e. −how = “cross”At first, let us import the pandas library with an alias −import pandas as pd Create DataFrame1 −dataFrame1 = pd.DataFrame(    {       "Car": ['BMW', 'Mustang', 'Bentley', 'Jaguar'], "Units": [100, 150, 110, 120] } )Create DataFrame2dataFrame2 = pd.DataFrame(    {       "Car": ['BMW', 'Tesla', 'Jaguar'], "Reg_Price": [7000, 8000, 9000] } )Next, merge DataFrames with "cross" in "how" parameter i.e. ... Read More

Merge Pandas DataFrame with Common Column and Set NaN for Unmatched Values

AmitDiwan
Updated on 29-Sep-2021 07:09:45

873 Views

To merge two Pandas DataFrame with common column, use the merge() function and set the ON parameter as the column name. To set NaN for unmatched values, use the “how” parameter and set it left or right. That would mean, merging left or right.At first, let us import the pandas library with an alias −import pandas as pdLet us create DataFrame1 −dataFrame1 = pd.DataFrame(    {       "Car": ['BMW', 'Lexus', 'Audi', 'Mustang', 'Bentley', 'Jaguar'], "Units": [100, 150, 110, 80, 110, 90] } )Let us create DataFrame2dataFrame2 = pd.DataFrame(    {       "Car": ['BMW', ... Read More

Create MultiIndex from DataFrame in Python Pandas

AmitDiwan
Updated on 29-Sep-2021 06:50:34

702 Views

To create Multiindex from DataFrame, use the MultiIndex. from_frame() method. At first, let us create a Dictionary of lists −d = {'Car': ['BMW', 'Lexus', 'Audi', 'Mercedes', 'Jaguar', 'Bentley'], 'Date_of_purchase': ['2020-10-10', '2020-10-12', '2020-10-17', '2020-10-16', '2020-10-19', '2020-10-22'] }Next, create a Pandas DataFrame from the above dictionary of lists −dataFrame = pd.DataFrame(d)Now create multiindex using from_frame() −print(pd.MultiIndex.from_frame(dataFrame))ExampleFollowing is the code −import pandas as pd # dictionary of lists d = {'Car': ['BMW', 'Lexus', 'Audi', 'Mercedes', 'Jaguar', 'Bentley'], 'Date_of_purchase': ['2020-10-10', '2020-10-12', '2020-10-17', '2020-10-16', '2020-10-19', '2020-10-22']} # creating dataframe from the above dictionary of lists dataFrame = pd.DataFrame(d) print("DataFrame...", dataFrame) # creating ... Read More

Difference Between Security Market Line (SML) and Capital Market Line (CML)

Probir Banerjee
Updated on 29-Sep-2021 06:14:04

9K+ Views

The security market line (SML) is a graph that is drawn with the values obtained from the capital asset pricing model (CAPM). It is a theoretical presentation of expected returns of assets that are based on systematic risk.Non-diversifiable risk is not represented by the SML. In a broader sense, the SML shows the expected market returns at a given level of market risk for marketable security. The overall level of risk is measured by the beta of the security against the market level of risk.Security Market Line AssumptionsSince the security market line is a representation of the CAPM, the assumptions ... Read More

Relationship Between Correlation and Covariance

Probir Banerjee
Updated on 29-Sep-2021 06:11:45

1K+ Views

In simple words, both correlation and covariance show the relationship and the dependency between two variables.Covariance shows the direction of the path of the linear relationship between the variables while a function is applied to them.Correlation on the contrary measures both the power and direction of the linear relationship between two variables.In simple terms, correlation is a function of the covariance. The fact that differentiates the two is that covariance values are not standardized while correlation values are. The correlation coefficient of two variables can be obtained by dividing the covariance values of these variables by the multiplication of the ... Read More

What is Minimum Variance Portfolio

Probir Banerjee
Updated on 29-Sep-2021 06:09:34

2K+ Views

In a study done to link the variance with returns, it was found that both genres of portfolio construction measures – minimum volatility and low volatility – deliver market return more than the average. Their information ratios (IRs) also are not statistically significant. It was also found that both strategies let investors assume palpable risk, in relation to the market prices, for which investors were not compensated.Minimum Variance Portfolio (MVP)The concept of Modern Portfolio Theory (MPT) has been the milestone for finance professionals for portfolio construction since Harry Markowitz introduced the idea into finance in 1952. Every finance student has ... Read More

Advertisements