Tag: Existing
Java : How to update the value of an existing key in HashMap | put() vs replace()
In this article we will discuss different ways to update the value of an existing key in HashMap in Java. Suppose we have a HashMap of words and their frequency count i.e. Advertisements // Create a Map of words and their frequency count HashMap<String, Integer> mapOfWords = new HashMap<String, Integer>() { { put(“John”, 25); put(“at”, …
Java : How to update the value of an existing key in HashMap | put() vs replace()Read More
Python: How to append a new row to an existing csv file?
In this article, we will discuss how to append a row to an existing csv file using csv module’s reader / writer & DictReader / DictWriter classes. Suppose we have a CSV file students.csv, whose contents are, Advertisements Id,Name,Course,City,Session 21,Mark,Python,London,Morning 22,John,Python,Tokyo,Evening 23,Sam,Python,Paris,Morning There can be many ways in python, to append a new row at the …
Python: How to append a new row to an existing csv file?Read More
Python: Add a column to an existing CSV file
In this article we will discuss how to add a column to an existing CSV file using csv.reader and csv.DictWriter classes. A part from appending the columns we will also discuss how to insert columns in between other columns of the existing CSV file. There are no direct functions in a python to add a …
MySQL increase VARCHAR size of column without breaking existing data
This article will see how to increase the size of a VARCHAR datatype column for a MySQL table. Also, we will ensure that we do not lose or break the column’s existing data. Table of Content Syntax ALTER statement MODIFY to increase column size ALTER statement CHANGE to increase column size Let us get started …
MySQL increase VARCHAR size of column without breaking existing dataRead More
MySQL add index to existing table
In this article, we will see how to add indices to an existing table. Indexes are used when we want to find the values of a column rapidly. Table of contents:- MySQL Add PRIMARY Key as Index MySQL Add UNIQUE Index MySQL Add ORDINARY Index MySQL Add FULLTEXT Index Assume that we have an existing …
MySQL add primary key to existing table
This article will look into adding a primary key to an existing table with and without data. We will be illustrating the concept using different examples. Table of Contents:- MySQL add primary key to existing empty table MySQL add primary key to existing table with data Let us get started by preparing the sample data. …
Add a new column to an existing DataFrame in Pandas
We often encounter scenarios in which we either need to add some information in the same DataFrame. In this article, we will discuss different ways to achieve that. Table of Contents Add new Column in DataFrame using direct assignment Add multiple columns to DataFrame using assign() function Insert new Column in DataFrame using insert() function …
Add a new column to an existing DataFrame in PandasRead More
How to add Pandas DataFrame to an existing csv file?
In this article, we will discuss the method to add pandas data to an existing CSV file. Table of Content Introduction to DataFrame.to_csv() Preparing csv file Create a new DataFrame to append Append DataFrame into existing file Summary Introduction to DataFrame.to_csv() We are going to use the DataFrame.to_csv() function for the same, so let’s understand …
How to add Pandas DataFrame to an existing csv file?Read More
Create New Dictionary from Existing Dictionary in Python
This tutorial will discuss about unique ways to create new dictionary from existing dictionary in Python. Table Of Contents Using Dictionary Comprehension Using Dictionary copy() method Summary Using Dictionary Comprehension Suppose we have an existing dictionary, Advertisements oldDict = { ‘Ritika’: 34, ‘Smriti’: 41, ‘Mathew’: 42, ‘Justin’: 38} Now we want to create a new …
Create New Dictionary from Existing Dictionary in PythonRead More