Posts

Read and Store data from csv file in Python

In your python development, there are many instances when you need to read some data from CSV or may need to store results (final or intermediate) to csv files, So in this article we will see some ways to read and store Pandas dataframe in csv files.   import pandas as pd df = pd.DataFrame({'column1': [2, 4, 8, 0], 'column2': [6, 0, 0, 0], 'column3': [10, 2, 1, 8], 'column4': [14, 5, 32, 68]}) df.to_csv("temp.csv", index=False) print(pd.read_csv("temp.csv")) # print Dataframe print(df) if you want to raed csv line by line then use csv package as below: import csv with open('temp.csv') as csv_file: csv_reader = csv.reader(csv_file, delimiter=',') line_count = 0 for row in csv_reader: if line_count == 0: print(f'Column names are {", ".join(row)}') line_count += 1 else: pri

Store data in MySQL using Python : sample code

Store data in MYSQL in Python Many times in your python application you may need to store results or some data into relational database and MySQL is one of the most widely used relational database. In this post we are presenting you with a sample script to insert records in MySQL table.  In below example we will be using mysql connector python for demonstration. import mysql.connector from mysql.connector import Error from mysql.connector import errorcode try: connection = mysql.connector.connect(host='localhost', database='test', user='root', password='root') print("connection is open") query = """INSERT INTO Person (`Name`, `Age`, `DOB`, `Address`) VALUES ('ABC', 134,'2001-08-14', 'Rajasthan, India') """ cursor = co

Easiest way to Dockerize your Java application using Jib plugin

Containerizing a Java application is no easy an easy job, it requires to create Docker file with many commands within it along with base image and many other things. Due to all these things developers at Google has decided to simplify this process of Containerizing an application using some pluggins, so they have created a library called Jib . How to use Jib to dockerize/Containerize your Java/Springboot application: There is a Maven and Gradle plugin available which requires minimal configuration. For running Gradle execute : gradle jib  or gradle jibDockerBuild and Maven command: mvn compile jib:build mvn compile jib:dockerBuild In my opinion it is quite simple job to use this pluggin which simplifies the Java development and creates container images on the fly.

Kubernetes - 413 Request Entity Too Large

While configuring the NGINX Ingress Controller, you may face some issues with file upload requests. Using annotations you can customize various configuration settings.  In the case of nginx upload limits, use the annotation below: nginx.ingress.kubernetes.io/proxy-body-size: "0" This annotation removes any restriction on upload size. Of course, you can set this to a size appropriate to your situation, 0 means unlimited. I will update this blogpost when I get some free time, till then happy reading!