I am trying to change the font in a table I made in stargazer() to Times New Roman and can't figure out how to do that. I made 4 multiple regression models and put them all into a single table.
stargazer(reg3FModel1, reg3FModel2, reg3FModel3, reg3FModel4,
single.row = TRUE,
digits = 2,
font.size = "large",
type = "text",
model.numbers = FALSE,
dep.var.caption = "Response variables",
omit.stat = c("rsq", "adj.rsq", "ser", "f", "n"),
title = "Regression Analysis with 3-Factor Model")
Related
I am trying to run the query in power query editor and it failed with below error
where as the same query works fine in winserver 2016 and it fails with above error in win server 2019. Am I missing any thing ?
I did compared the settings and everything looks good.
let
//Get data Report H1
Source1 = Excel.Workbook(File.Contents("\\path\filename.xlsx"), null, true),
#"classic_Sheet1" = Source1{[Item = "classic", Kind = "Sheet"]}[Data],
#"Trimmed Text1" = Table.TransformColumns(#"classic_Sheet1", Text.Trim),
#"Third Row as Header1" = Table.PromoteHeaders(Table.Skip(#"Trimmed Text1", 2)),
#"Selected Columns1" = Table.SelectColumns(
#"Third Row as Header1",
{" ID", " Status", "Customer Id ", "Agent", "Leg"}
),
//Get Report H2
Source2 = Excel.Workbook(File.Contents("\\path\filename.xlsx"), null, true),
#"classic_Sheet2" = Source2{[Item = "classic", Kind = "Sheet"]}[Data],
#"Trimmed Text2" = Table.TransformColumns(#"classic_Sheet2", Text.Trim),
#"Third Row as Header2" = Table.PromoteHeaders(Table.Skip(#"Trimmed Text2", 2)),
#"Selected Columns2" = Table.SelectColumns(
#"Third Row as Header2",
{" ID", "Status", "Customer Id ", "Agent", "Leg"}
)
in
#"Excluded IDs"
The error message is pointing you to the problem:
Table.TransformColumns expects a list as the second parameter,
while you are providing a function:
Table.TransformColumns(
table as table,
transformOperations as list,
optional defaultTransformation as nullable function,
optional missingField as nullable number
) as table
Please read the official documentation here:
https://learn.microsoft.com/en-us/powerquery-m/table-transformcolumns
The issue has nothing to do with winserver 2016 or winserver 2019.
You want something along these lines
= Table.TransformColumns(#"classic_Sheet1",{{"ColumnNameHere", Text.Trim, type text}})
= Table.TransformColumns(#"classic_Sheet1"",{{"ColumnNameHere", Text.Trim, type text}, {"DifferentColumnNameHere", Text.Trim, type text}})
I am new to transformer based models. I am trying to fine-tune the following model (https://huggingface.co/Chramer/remote-sensing-distilbert-cased) on my dataset. The code:
enter image description here
and I got the following error:
enter image description here
I will be thankful if anyone could help.
The preprocessing steps I followed:
input_ids_t = []
attention_masks_t = []
for sent in df_train['text_a']:
encoded_dict = tokenizer.encode_plus(
sent,
add_special_tokens = True,
max_length = 128,
pad_to_max_length = True,
return_attention_mask = True,
return_tensors = 'tf',
)
input_ids_t.append(encoded_dict['input_ids'])
attention_masks_t.append(encoded_dict['attention_mask'])
# Convert the lists into tensors.
input_ids_t = tf.concat(input_ids_t, axis=0)
attention_masks_t = tf.concat(attention_masks_t, axis=0)
labels_t = np.asarray(df_train['label'])
and i did the same for testing data. Then:
train_data = tf.data.Dataset.from_tensor_slices((input_ids_t,attention_masks_t,labels_t))
and the same for testing data
It sounds like you are feeding the transformer_model 1 input instead of 3. Try removing the square brackets around transformer_model([input_ids, input_mask, segment_ids])[0] so that it reads transformer_model(input_ids, input_mask, segment_ids)[0]. That way, the function will have 3 arguments and not just 1.
I would like to convert the data scraping from an internet site, regarding the time, the data is extracted like this (for example 9:15) and inserted into the cell, I would like at the bottom of the column to make the total of the hours, the problem I would like python to convert it to numerical format so that I can add it up.
any idea?
def excel():
# Writing on a EXCEL FILE
filename = f"Monatsplan {userfinder} {month} {year}.xlsx"
try:
wb = load_workbook(filename)
ws = wb.worksheets[0] # select first worksheet
except FileNotFoundError:
headers_row = [
"Datum",
"Tour",
"Funktion",
"Von",
"Bis",
"Schichtdauer",
"Bezahlte Zeit",
]
wb = Workbook()
ws = wb.active
ws.append(headers_row)
wb.save(filename)
ws.append(
[
datumcleaned[:10],
tagesinfo,
"",
"",
"",
"",
"",
]
)
wb.save(filename)
wb.close()
excel()
You should split the data you scrapped.
time_scrapped = '9:15'
time_split = time_scrapped.split(":")
hours = int(time_split[0])
minutes = int(time_split[1])
Then you can place it in separate columns and create formula at the bottom of the column.
I have a swarmplot:
sns.swarmplot(y = "age gap corr", x = "cluster",
data = scatter_data, hue = 'group', dodge=True)
and I would like to adjust the transparency of the dots:
sns.swarmplot(y = "age gap corr", x = "cluster",
data = scatter_data, hue = 'group', dodge=True,
scatter_kws = {'alpha': 0.1})
sns.swarmplot(y = "age gap corr", x = "cluster",
data = scatter_data, hue = 'group', dodge=True,
plot_kws={'scatter_kws': {'alpha': 0.1}})
but neither of the above methods works.
any help is appreciated.
You can simply input the alpha argument directly in the swarmplot function:
import seaborn as sns
df = sns.load_dataset('diamonds').sample(1000)
sns.swarmplot(data=df, x='cut', y='carat', hue='color', alpha=0.5)
The documentation for swarmplot states
kwargs : key, value mappings
Other keyword arguments are passed through to matplotlib.axes.Axes.scatter().
Thus, you don't need to use scatter_kws={...}.
Compare this to, e.g., sns.lmplot, which states
{scatter,line}_kws : dictionaries
Additional keyword arguments to pass to plt.scatter and plt.plot.
In GTK/Python, I'm trying to build an interface with nodes.
This is photo of my interface
I create one liststore and I want to filter different things. The user has to do two actions, first, he has to choose in the combobox the type of filter that he wants to use, if he wants to filter by node's type, node's beginning name or others.
Then in the text entry, he decides what information that he wants to see. Take the exemple of nodes type. There are like 3 different types of nodes, node type 1, node type 2 and node type 3. As an user I want to see only node type 1, so I write 1 in the node entry. Actually I have a problem, it is my filter does not work.
I first create 2 liststores:
def create_liststore(self):
if len(self.FdessinCarto.pos) != 0:
for i,node in enumerate(self.FdessinCarto.pos):
self.node_liststore.append([str(node.title),self.controller.model.string_from_numdate(int(node.start_time)),self.controller.model.string_from_numdate(int(node.end_time)),str(node.node_group),str(node.description),str(node.attachment_list)])
self.edgelist = self.controller.get_edge_list()
if len(self.edgelist) !=0:
for i in self.edgelist:
edge_prop=self.controller.edge_data(i[0],i[1])
self.edge_liststore.append([edge_prop['label'],str(i[0].title),str(i[1].title),edge_prop['description'],edge_prop['attachment_list']])
#creating the treeview for Node, making it use the filter as a model, and adding the columns
self.treeviewNode = Gtk.TreeView.new_with_model(self.node_liststore)
for i, column_title in enumerate(["Name", "Beginning date", "End date", "Type of node", "Description of node","files"]):
self.Noderenderer = Gtk.CellRendererText()
self.Noderenderer.set_property("editable", True)
column = Gtk.TreeViewColumn(column_title, self.Noderenderer, text=i)
column.set_sort_column_id(0)
self.treeviewNode.append_column(column)
#creating the treeview for edge
self.treeviewEdge = Gtk.TreeView.new_with_model(self.edge_liststore)
for i, column_title in enumerate(["Name", "Node 1", "Node 2", "Description of edge","file"]):
self.Edgerenderer = Gtk.CellRendererText()
self.Edgerenderer.set_property("editable", True)
column = Gtk.TreeViewColumn(column_title, self.Edgerenderer, text=i)
column.set_sort_column_id(0)
self.treeviewEdge.append_column(column)
self.SWViewListStore.add(self.treeviewNode)
self.SWEdgeStore.add(self.treeviewEdge)
self.SWViewListStore.show_all()
self.SWEdgeStore.show_all()
There are my 3 different filters:
#creating the filtre
self.node_beginning_date_filter = self.node_liststore.filter_new()
self.node_end_date_filter = self.node_liststore.filter_new()
self.node_type_filter = self.node_liststore.filter_new()
#setting the filter function, note that we're not using the
self.node_end_date_filter.set_visible_func(self.node_end_date_filter_func)
self.node_beginning_date_filter.set_visible_func(self.node_beginning_date_filter_func)
self.node_type_filter.set_visible_func(self.node_type_filter_func)
Once I change my combo-box, it would activate my function, it took the type of combofilter then also the text of combobox :
def on_entryComboBox_changed(self,widget):
textComboFilter = self.View.combo_filter.get_active_text()
print("textComboFilter %s" %textComboFilter)
if textComboFilter == "Filter by node's beginning date":
#print("%s language selected!" % textComboFilter)
self.View.current_filter = textComboFilter
self.View.node_beginning_date_filter.refilter()
if textComboFilter == "Filter by node's end date":
#print("%s language selected!" % textComboFilter)
self.View.current_filter = textComboFilter
self.View.node_end_date_filter.refilter()
if textComboFilter == "Filter by type of node":
#print("%s language selected!" % textComboFilter)
self.View.current_filter = textComboFilter
self.View.node_type_filter.refilter()
And it does not work.
Finally,
I manage to answer it on my own.
You should build one filter rather than three. For people who have the same problem, this is a very good example which helps me to solve my problem.
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
#list of tuples for each software, containing the software name, initial release, and main programming languages used
software_list = [("Firefox", 2002, "C++"),
("Eclipse", 2004, "Java" ),
("Pitivi", 2004, "Python"),
("Netbeans", 1996, "Java"),
("Chrome", 2008, "C++"),
("Filezilla", 2001, "C++"),
("Bazaar", 2005, "Python"),
("Git", 2005, "C"),
("Linux Kernel", 1991, "C"),
("GCC", 1987, "C"),
("Frostwire", 2004, "Java")]
class TreeViewFilterWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Treeview Filter Demo")
self.set_border_width(10)
#Setting up the self.grid in which the elements are to be positionned
self.grid = Gtk.Grid()
self.grid.set_column_homogeneous(True)
self.grid.set_row_homogeneous(True)
self.add(self.grid)
#Creating the ListStore model
self.software_liststore = Gtk.ListStore(str, int, str)
for software_ref in software_list:
self.software_liststore.append(list(software_ref))
self.current_filter_language = None
#Creating the filter, feeding it with the liststore model
self.language_filter = self.software_liststore.filter_new()
#setting the filter function, note that we're not using the
self.language_filter.set_visible_func(self.language_filter_func)
#creating the treeview, making it use the filter as a model, and adding the columns
self.treeview = Gtk.TreeView.new_with_model(self.language_filter)
for i, column_title in enumerate(["Software", "Release Year", "Programming Language"]):
renderer = Gtk.CellRendererText()
column = Gtk.TreeViewColumn(column_title, renderer, text=i)
self.treeview.append_column(column)
#creating buttons to filter by programming language, and setting up their events
self.buttons = list()
for prog_language in ["Java", "C", "C++", "Python", "None"]:
button = Gtk.Button(prog_language)
self.buttons.append(button)
button.connect("clicked", self.on_selection_button_clicked)
#setting up the layout, putting the treeview in a scrollwindow, and the buttons in a row
self.scrollable_treelist = Gtk.ScrolledWindow()
self.scrollable_treelist.set_vexpand(True)
self.grid.attach(self.scrollable_treelist, 0, 0, 8, 10)
self.grid.attach_next_to(self.buttons[0], self.scrollable_treelist, Gtk.PositionType.BOTTOM, 1, 1)
for i, button in enumerate(self.buttons[1:]):
self.grid.attach_next_to(button, self.buttons[i], Gtk.PositionType.RIGHT, 1, 1)
self.scrollable_treelist.add(self.treeview)
self.show_all()
def language_filter_func(self, model, iter, data):
"""Tests if the language in the row is the one in the filter"""
if self.current_filter_language is None or self.current_filter_language == "None":
return True
else:
return model[iter][2] == self.current_filter_language
def on_selection_button_clicked(self, widget):
"""Called on any of the button clicks"""
#we set the current language filter to the button's label
self.current_filter_language = widget.get_label()
print("%s language selected!" % self.current_filter_language)
#we update the filter, which updates in turn the view
self.language_filter.refilter()
win = TreeViewFilterWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()