database

Merge multiple (2+) dataframes in Pandas with a proper column name

Merge multiple (2+) dataframes in Pandas with a proper column name Question: everyone. I have the following list of dataframes: df_eurusd = DownloadData(‘EUR/USD’,start_date,end_date,timeframe).GetData() df_usdjpy = DownloadData(‘USD/JPY’,start_date,end_date,timeframe).GetData() df_gbpusd = DownloadData(‘GBP/USD’,start_date,end_date,timeframe).GetData() df_usdcad = DownloadData(‘USD/CAD’,start_date,end_date,timeframe).GetData() df_usdsek = DownloadData(‘USD/SEK’,start_date,end_date,timeframe).GetData() df_usdchf = DownloadData(‘USD/CHF’,start_date,end_date,timeframe).GetData() tickers = { ‘EUR/USD’ : df_eurusd, ‘USD/JPY’ : df_usdjpy, ‘GBP/USD’ : df_gbpusd, ‘USD/CAD’ : df_usdcad, ‘USD/SEK’ : …

Total answers: 2

Matplotlib plotting nan values

Matplotlib plotting nan values Question: I am trying to plot a bar graph in matplotlib, but somehow it plots the nan values. import pandas as pd import matplotlib.pyplot as plt import math engine_data= pd.read_excel(‘edb-emissions-databank_v28c_web.xlsx’, sheet_name = ‘nvPM Emissions’) manufacturers = engine_data.value_counts(‘Manufacturer’).index.values def Average(engine_type, column, manufacturer): averages = [] for manufacturer in manufacturers: average = engine_data[(engine_data.iloc[:,2]== …

Total answers: 1

Insert multiple list in database using python django

Insert multiple list in database using python django Question: Im confused on how can I insert multiple list bycolumn using a loop, let say the output what I want in database is something like this name percentage is_fixed_amount PWD 20 0 Senior 20 0 OPD 6 0 Corporators 20 0 Special 1 What I’ve tried …

Total answers: 1

How do I connect my telegram bot (telebot) to PostgreSQL url

How do I connect my telegram bot (telebot) to PostgreSQL url Question: I would like to learn how to connect my telegram bot to database url so that I store bot users, date of join and user information. Help me through that tutorial. How to connect a my telegram bot to PostgreSQL/database url. #code from …

Total answers: 1

When running containers, the server cannot connect to the database

When running containers, the server cannot connect to the database Question: I’ve got an issue where my Fastapi app image can’t connect to a database that’s also in a container But if you turn on the database and run the application not through docker, then everything works and the connection to the database is established …

Total answers: 1

python big json database loading

python big json database loading Question: The application I am making requires me to load a json file which is 100mb-1gb. I used json library but it takes a lot of time to load then, I tried to switch to yaml but was rather slower than json. So is there a library (for dumping/loading) which …

Total answers: 1

The first field in the models.py not created, how to fix it? (django)

The first field in the models.py not created, how to fix it? (django) Question: I have written two classes in models.py (Django): class Name_tickers(models.Model): ticker = models.CharField(max_length = 32) name = models.CharField(max_length = 100) def __str__(self): return self.ticker class Close_stock(models.Model): date = models.DateField(), tiker_name = models.ForeignKey(Name_tickers, on_delete=models.CASCADE), price = models.DecimalField(max_digits=15, decimal_places=5) But was created: migrations.CreateModel( …

Total answers: 1

Remove duplicates in an object in JSONiq

Remove duplicates in an object in JSONiq Question: This is an example object that I got: { "query1" : [ { "name" : "John", "id" : 1234 }, { "name" : "Rose", "id" : 3214 }, { "name" : "John", "id" : 1234 } ] } How can I remove the duplicates using group by …

Total answers: 3

Determining rows and columns in data txt file?

Determining rows and columns in data txt file? Question: So the question is: The rows in the data to be loaded represent various time points of measurement (called "frames" henceforth), the columns various measurements provided by the experimental apparatus at those time points. The data is in the tab-delimited text file called "exampleData.txt" and can …

Total answers: 1

Django: How can I change my code to access ForeignKey fields through 3 tables?

Django: How can I change my code to access ForeignKey fields through 3 tables? Question: I tried to get values with using three tables. cart_c = Cart.objects.select_related(‘item’).filter(user=2) context = {‘cart_c’: cart_c} I got QuerySet, ‘cart_c’, but I could not refer ItemPhoto.photo from ‘cart_c’. So, I made three tables joined with prefetch_related(). items = Item.objects.prefetch_related(‘item_photo’, ‘cart_item’).filter(cart__user=2) …

Total answers: 1