1603767172
This video shows how to concatenate data frames using the pandas library in Python. Data frame concatenation, also known as pasting or binding, just means joining together two data frames that have either the same columns or the same rows. In other words, using concatenate lets you add more rows or columns to an existing data frame. Concatenation should not be confused with join (merge) operations that involve combining the records of two data tables based on one or more shared key columns.
import pandas as pd
data = pd.DataFrame({“character”: [“Goku”,“Vegeta”, “Nappa”,“Gohan”,“Piccolo”],
“power level”: [12000, 16000, 4000, 1500, 3000]})
data
new_rows = pd.DataFrame({“character”: [“Tien”,“Yamcha”, “Krillin”],
“power level”: [2000, 1600, 2000]})
new_rows
Concatenate Data Frames by Rows
data2 = pd.concat([data, new_rows], # List of data Frames to concatenate
axis=0, # Axis = 0 to concat by row
ignore_index=True)
data2
new_cols = pd.DataFrame({“uniform color”: [“orange”, “blue”, “black”, “orange”,
“purple”, “green”, “orange”, “orange”],
“species”:[“saiyan”,“saiyan”,“saiyan”,“half saiyan”,
“namak”,“human”,“human”,“human”]})
new_cols
Concatenate Data Frames by Columns
pd.concat([data2, new_cols], # List of data Frames to concatenate
axis=1) # Axis = 1 to concat by column
Subscribe : https://www.youtube.com/c/DataDaft?sub_confirmation=1
#python
1620466520
If you accumulate data on which you base your decision-making as an organization, you should probably think about your data architecture and possible best practices.
If you accumulate data on which you base your decision-making as an organization, you most probably need to think about your data architecture and consider possible best practices. Gaining a competitive edge, remaining customer-centric to the greatest extent possible, and streamlining processes to get on-the-button outcomes can all be traced back to an organization’s capacity to build a future-ready data architecture.
In what follows, we offer a short overview of the overarching capabilities of data architecture. These include user-centricity, elasticity, robustness, and the capacity to ensure the seamless flow of data at all times. Added to these are automation enablement, plus security and data governance considerations. These points from our checklist for what we perceive to be an anticipatory analytics ecosystem.
#big data #data science #big data analytics #data analysis #data architecture #data transformation #data platform #data strategy #cloud data platform #data acquisition
1593156510
At the end of 2019, Python is one of the fastest-growing programming languages. More than 10% of developers have opted for Python development.
In the programming world, Data types play an important role. Each Variable is stored in different data types and responsible for various functions. Python had two different objects, and They are mutable and immutable objects.
Table of Contents hide
III Built-in data types in Python
The Size and declared value and its sequence of the object can able to be modified called mutable objects.
Mutable Data Types are list, dict, set, byte array
The Size and declared value and its sequence of the object can able to be modified.
Immutable data types are int, float, complex, String, tuples, bytes, and frozen sets.
id() and type() is used to know the Identity and data type of the object
a**=25+**85j
type**(a)**
output**:<class’complex’>**
b**={1:10,2:“Pinky”****}**
id**(b)**
output**:**238989244168
a**=str(“Hello python world”)****#str**
b**=int(18)****#int**
c**=float(20482.5)****#float**
d**=complex(5+85j)****#complex**
e**=list((“python”,“fast”,“growing”,“in”,2018))****#list**
f**=tuple((“python”,“easy”,“learning”))****#tuple**
g**=range(10)****#range**
h**=dict(name=“Vidu”,age=36)****#dict**
i**=set((“python”,“fast”,“growing”,“in”,2018))****#set**
j**=frozenset((“python”,“fast”,“growing”,“in”,2018))****#frozenset**
k**=bool(18)****#bool**
l**=bytes(8)****#bytes**
m**=bytearray(8)****#bytearray**
n**=memoryview(bytes(18))****#memoryview**
Numbers are stored in numeric Types. when a number is assigned to a variable, Python creates Number objects.
#signed interger
age**=**18
print**(age)**
Output**:**18
Python supports 3 types of numeric data.
int (signed integers like 20, 2, 225, etc.)
float (float is used to store floating-point numbers like 9.8, 3.1444, 89.52, etc.)
complex (complex numbers like 8.94j, 4.0 + 7.3j, etc.)
A complex number contains an ordered pair, i.e., a + ib where a and b denote the real and imaginary parts respectively).
The string can be represented as the sequence of characters in the quotation marks. In python, to define strings we can use single, double, or triple quotes.
# String Handling
‘Hello Python’
#single (') Quoted String
“Hello Python”
# Double (") Quoted String
“”“Hello Python”“”
‘’‘Hello Python’‘’
# triple (‘’') (“”") Quoted String
In python, string handling is a straightforward task, and python provides various built-in functions and operators for representing strings.
The operator “+” is used to concatenate strings and “*” is used to repeat the string.
“Hello”+“python”
output**:****‘Hello python’**
"python "*****2
'Output : Python python ’
#python web development #data types in python #list of all python data types #python data types #python datatypes #python types #python variable type
1619510796
Welcome to my Blog, In this article, we will learn python lambda function, Map function, and filter function.
Lambda function in python: Lambda is a one line anonymous function and lambda takes any number of arguments but can only have one expression and python lambda syntax is
Syntax: x = lambda arguments : expression
Now i will show you some python lambda function examples:
#python #anonymous function python #filter function in python #lambda #lambda python 3 #map python #python filter #python filter lambda #python lambda #python lambda examples #python map
1623992040
Data processing is and data wrangling is one of the important components of a data science model development pipeline. A data scientist spends 80% of their time preparing the dataset to make it fit for modeling. Sometimes performing data wrangling and explorations for a large-sized dataset becomes a tedious task, and one is only left to either wait quite long till the computations are completed or shift to some parallel processing.
Pandas is one of the famous Python libraries that has a vast list of API, but when it comes to scalability, it fails miserably. For large-size datasets, it takes a lot of time sometimes even hours just to iterate over the loops, and even for small-size datasets, iterating over the data frame using standard loops is quite time-consuming,
In this article, we will discuss techniques or hacks to speed the iteration process over large size datasets.
(Image by Author), Time constraints comparison to iterate over the data frame
#data-science #python #education #faster pandas #pandas data frame #400x times faster pandas data frame iteration
1623488340
Pandas is one of the predominant data analysis tools which is highly appreciated among data scientists. It provides numerous flexible and versatile functions to perform efficient data analysis.
In this article, we will go over 3 pandas tricks that I think will make you a more happy pandas user. It is better to explain these tricks with some examples. Thus, we start by creating a data frame to wok on.
The data frame contains daily sales quantities of 3 different stores. We first create a period of 10 days using the date_range
function of pandas.
import numpy as np
import pandas as pd
days = pd.date_range("2020-01-01", periods=10, freq="D")
The days variable will be used as a column. We also need a sales quantity column which can be generated by the randint
function of numpy. Then, we create a data frame with 3 columns for each store.
#machine-learning #data-science #python #python pandas tricks #efficient data analysis #python pandas tricks for efficient data analysis