Python Data structures

FeaturesListTupleDictionarySetSeries (pandas)Dataframes (pandas)
Ideal for
Sequential, mutable dataSequential, immutable dataMapping dataRemoving duplicates, set operationsTime series, single variable analysisMulti-variable analysis, data manipulation
Main Use caseStoring ordered collectionsImmutable sequencesKey-value pairsUnique elements
Single column data
Tabular data
Data typeAny
AnyAny (for values)Immutable types onlyHomogeneousHeterogeneous (by column)
OrderedYesYesYes NoYesYes
Mutable*YesNoYesYesYesYes
Access byIndexIndexKeyN/AIndex or labelRow/column index or label
Allows duplicatesYesYesNoNoYesYes

* Refers to whether an object can be changed after it is created. Immutable objects provide a level of safety and predictability in certain scenarios, but mutable objects can be more memory-efficient for operations that require frequent modifications.

Standard Linear Regression with Python

Regression OLS with Python
sns.regplot (x=”distance_Sqrt”, y=”price_Sqrt”, data=taiwan_real_estate, ).resid plt.show()# Plotting correlation heatmap import seaborn as sb import matplotlib.pyplot as mp dataplot = sb.heatmap(taiwan_RE_core_varr.corr(numeric_only=True), cmap=”YlGnBu”, annot=True) # Displaying heatmap mp.show()