Creating a Parallax Scrolling Effect in React using React Spring

Ath Tripathi
Updated on 28-Sep-2021 12:24:22

2K+ Views

In this article, we will see how to make the popular parallax effect in React.js using react-spring animation library. Parallax is a displacement or difference in the apparent position of an object viewed along two different lines of sight, and is measured by the angle of inclination between those two lines. Parallax scrolling is an effect where the background content moves at a different speed than the foreground content. So, let's get started.First create a React project −npx create-react-app tutorialpurposeGo to the project directory −cd tutorialpurposeExampleInstall the following packages −npm install react-spring npm i --save @react-spring/parallaxreact-spring is used to add ... Read More

Drop Null Rows from a Pandas DataFrame in Python

AmitDiwan
Updated on 28-Sep-2021 12:19:21

2K+ Views

To drop the null rows in a Pandas DataFrame, use the dropna() method. Let’s say the following is our CSV file with some NaN i.e. null values −Let us read the CSV file using read_csv(). Our CSV is on the Desktop −dataFrame = pd.read_csv("C:\Users\amit_\Desktop\CarRecords.csv")Remove the null values using dropna() −dataFrame = dataFrame.dropna() ExampleFollowing is the complete code −import pandas as pd # reading csv file dataFrame = pd.read_csv("C:\Users\amit_\Desktop\CarRecords.csv") print("DataFrame...", dataFrame) # count the rows and columns in a DataFrame print("Number of rows and column in our DataFrame = ", dataFrame.shape) dataFrame = dataFrame.dropna() print("DataFrame after removing null ... Read More

Make a Cylinder in React Using React Three Fiber

Ath Tripathi
Updated on 28-Sep-2021 12:14:47

2K+ Views

In this article, we will see how to create a basic cylinder-like shape in React using react-three-fiber. Three.js is a cross-browser JavaScript library and application programming interface used to create and display animated 3D computer graphics in a web browser using WebGL.ExampleFirst download the react-three-fiber package −npm i --save @react-three/fiber threethreejs and react-three/fiber will be used to add webGL renderer to the website. Three-fiber will be used to connect threejs and React.Add the following lines of code in App.js −import React, { useEffect, useRef } from "react"; import { Canvas, useFrame } from "@react-three/fiber"; import * as THREE from "three"; ... Read More

Making an Axes Helper in React using React Three Fiber

Ath Tripathi
Updated on 28-Sep-2021 12:13:54

2K+ Views

Axes helpers are used to show direction in three-dimensional figures when you apply any orbit control. Axes use the concept of coordinate geometry to show how to make shapes and make orbits for zooming, rotating, sliding, etc. They are really helpful while developing a 3D environment.ExampleFirst download the react-three-fiber package −npm i --save @react-three/fiber threethreejs and react-three/fiber will be used to add webGL renderer to the website. Three-fiber will be used to connect threejs and React.We will first make a cuboid and an orbit control for better viewAdd the following lines of code in App.js −import React, { useEffect } ... Read More

Skip Initial Space from DataFrame in Python Pandas

AmitDiwan
Updated on 28-Sep-2021 12:11:30

6K+ Views

To skip initial space from a Pandas DataFrame, use the skipinitialspace parameter of the read_csv() method. Set the parameter to True to remove extra space.Let’s say the following is our csv file −We should get the following output i.e. skipping initial whitespace and displaying the DataFrame from the CSV −ExampleFollowing is the complete code −import pandas as pd # reading csv file dataFrame = pd.read_csv("C:\Users\amit_\Desktop\CarRecords.csv") print("DataFrame...", dataFrame) # reading csv file and removing initial space dataFrame = pd.read_csv("C:\Users\amit_\Desktop\CarRecords.csv", skipinitialspace = True) print("DataFrame...", dataFrame)At first, read the CSV. Our CSV file is on the Desktop −dataFrame = pd.read_csv("C:\Users\amit_\Desktop\CarRecords.csv")While reading, ... Read More

Create a 3D Donut-Like Structure in React Using React Three Fiber

Ath Tripathi
Updated on 28-Sep-2021 12:05:20

619 Views

In this article, we are going to see how to make a 3D figure which will look like a donut. We will apply this in a webpage using react-three-fiber. We will use this package to make a donut-like shape which will keep moving and we will see it from inside of it.ExampleFirst, download important libraries −npm i --save @react-three/fiber threethreejs and react-three/fiber will be used to add webGL renderer to the website. Three-fiber will be used to connect threejs and React.Add the following lines of code in App.js −import React, { useRef } from "react"; import { Canvas, useFrame } ... Read More

Make a 3D Cube in React Using React Three Fiber

Ath Tripathi
Updated on 28-Sep-2021 12:00:05

3K+ Views

In this article, we will see how to use Three.js in React by using a third-party package react-three-fiber. Three.js is a cross-browser JavaScript library and application programming interface used to create and display animated 3D computer graphics in a web browser using WebGLExampleFirst of all, install the react-three-fiber package −npm i --save @react-three/fiber threethreejs and react-three/fiber will be used to add webGL renderer to the website.Add the following lines of code in App.js −import React, { useRef, useState } from "react"; import { Canvas, useFrame } from "@react-three/fiber"; function Box(props) {    const mesh = useRef();    useFrame(() => ... Read More

Make a Ring in React Using React Three Fiber

Ath Tripathi
Updated on 28-Sep-2021 11:53:44

2K+ Views

In this article, we will see how to use the react-three-fiber package in React to make a ring which will rotate. Three.js is a cross-browser JavaScript library and application programming interface used to create and display animated 3D computer graphics in a web browser using WebGLExampleFirst, download important libraries −npm i --save @react-three/fiber threethreejs and react-three/fiber will be used to add webGL renderer to the website.Add the following lines of code in index.css −* {    box-sizing: border-box; } html, body, #root{ width: 100%; height: 100%; margin: 0; ... Read More

Draw Boxplot and Display Datapoints with Swarm Plot in Python Pandas

AmitDiwan
Updated on 28-Sep-2021 11:52:27

469 Views

To plot swarm plot on top of box plot, at first, set boxplot() and then the swarmplot() with the same x and y values. Box Plot in Seaborn is used to draw a box plot to show distributions with respect to categories. The seaborn.boxplot() is used for this.Swarm Plot in Seaborn is used to draw a categorical scatterplot with non-overlapping points. The seaborn.swarmplot() is used for this.Let’s say the following is our dataset in the form of a CSV file − Cricketers.csvAt first, import the required libraries −import seaborn as sb import pandas as pd import matplotlib.pyplot as pltLoad data from ... Read More

Fill NaN Values Using Interpolation Method in Python Pandas

AmitDiwan
Updated on 28-Sep-2021 11:47:43

2K+ Views

Use the interpolate() method to fill NaN values. Let’s say the following is our CSV file opened in Microsoft Excel with some NaN values −Load data from a CSV file into a Pandas DataFrame −dataFrame = pd.read_csv("C:\Users\amit_\Desktop\SalesData.csv")Fill NaN values with interpolate() −dataFrame.interpolate()ExampleFollowing is the code −import pandas as pd # Load data from a CSV file into a Pandas DataFrame dataFrame = pd.read_csv("C:\Users\amit_\Desktop\SalesData.csv") print("DataFrame...", dataFrame) # fill NaN values with interpolate() res = dataFrame.interpolate() print("DataFrame after interpolation...", res) OutputThis will produce the following output −DataFrame...        Car   Reg_Price   Units 0      BMW ... Read More

Advertisements